Help Moving Pin Constraints? - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: General (https://obi.virtualmethodstudio.com/forum/forum-5.html) +--- Thread: Help Moving Pin Constraints? (/thread-2166.html) |
Moving Pin Constraints? - EmmetOT - 14-04-2020 I'm wondering is it possible to move pin constraints around on their attached collider's local space. I have the following code (adapted from one of your samples), Code: ObiConstraints<ObiPinConstraintsBatch> pinConstraints = m_ropeBlueprint.GetConstraintsByType(Oni.ConstraintType.Pin) as ObiConstraints<ObiPinConstraintsBatch>; I want to later come back here and say 'move constraint 0'. The "SourcePosition" property here will always provide the correct desired position in world space. I thought maybe I could do something like this, but nothing seems to happen when I call it: Code: private void SetStartConstraint() Any ideas? Or maybe this is inadvisable? RE: Moving Pin Constraints? - josemendez - 01-06-2020 Hi there! You're getting the constraints from the blueprint, not the actor, at runtime. Blueprints are assets, and they work just like prefabs: once you instantiate a blueprint, the instances (actors) are no longer "tied" to it. So changing a blueprint at runtime will only affect all instances created from that point on, existing instances will be unaffected. See: http://obi.virtualmethodstudio.com/tutorials/bigpicture.html Step #2 of what happens when an actor is added to the solver is key here: Quote:The actor makes a copy of all constraints found in the blueprint, and updates their particle references so that they point to the correct solver array positions. So do the same, but this time get the constraints from the actor instead (rope.GetConstraintsByType()). |