Sharing and please help: jit.phys, feedback loop,and moving towards a target
I am sharing two patches and would need help for a third.
This patch simply moves a little puck around the world randomly. You can change the view with "wasd-qz" and click on the puck to reset it. It moves with a fixed amount of force in the direction of its x (red) axis.
In this patch a little puck moves towards a blue ball. Every 5s the blue ball is moved to a random position. You can change the view with the "wasd-qz" keys. This patch works with a feedback loop between the torque and the current position and rotation of the puck in relation to the blue ball, but it definitely could be optimized inside of the "anglediff", "extract_rotatez" and "closeangle" subpatchers.
The help I need is to convert the second patch so it works in 3D. I wish @lookat was an object as I feel it could definitely be useful in this case.
Thank you in advance.
hello mrtof. cool patch!
i wanted to help you out with your 3D version.
the objects you want to use for this are jit.anim.node and jit.anim.drive.
anim.node has a lookat attribute, and anim.drive allows you to smoothly interpolate between orientations.
the patch below uses these objects to control a rigid-body, but it doesn't use the @torque attribute to set the orientation. it simply uses an anim.drive to animate the rotation, and set the rigid-body orientation via the @quat attribute.
i suppose you could extrapolate further using this patch as a starting point to get rotations via torque, but perhaps it's unnecessary.
please note, this patch will behave differently in 6.0.5 and the (soon to be released) 6.0.7.
this is because in the old version, physics bodies reset all forces whenever you adjust their transform attributes (position, or rotate attributes), however in the new version, this is no longer the case. you can still get the same effect with 6.0.5, but you have to crank up the force attribute z value.
you may also find the following example patch useful:
Max6/examples/jitter-examples/render/anim/anim.camera.advanced.maxpat
please let me know if you have further questions.
Hi, you solution is more elegant, especially once 6.0.7 is available.
I did come up with my own solution here:
Oh and thanks by the way!
Also, I though that jit.anim.node objects did not work unless they had another object bound to them... forgot to bang them.
nice! your solution is great in that it uses only forces for navigation.
glad you discovered something new for the anim objects.