jit.anim.drive to control scale and jit.phys.body to control position and rotate

Robin Price's icon

Any idea how I use jit.anim.drive to control the scale (I want to make something pulsate) and jit.phys.body to control the position on rotation of a gridshape?

My efforts crash jitter.

Andrew Benson's icon

Post a patch, so we can better see exactly what you are trying. Also, if you are getting reproducible crashes, please be sure and visit https://cycling74.com/max6-bug-form/ and let us know!

Robin Price's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Is this right? It seems weird.

Andrew Benson's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Try this.

By setting the @targetname , we don't have to connect directly to the controlled object. Then you can filter the messages coming from jit.anim.drive and send them where you want. HTH

Robin Price's icon

Cheers that seems better.

Rob Ramirez's icon

also, if you set @send_scale 1 on your phys.body, you only need to send the scale values to the phys.body, and they will propagate to the gl.gridshape.

Robin Price's icon

Cheers yeah, I unset it because having the gridshape receive scale from both phys and anim understandably made jitter angry.

Robin Price's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Something's still not right, I can use jit.anim to make both the phys and the gridshapes change their scales but when I try to move the phys object with an impulse message it moves for a tiny bit then stops.

Rob Ramirez's icon

simple rigid-body shapes don't like to be scaled. the engine basically recreates the collision shape everytime you adjust the scale. thus the forces are not working.

Max Patch
Copy patch and select New From Clipboard in Max.

however, convex-hull shapes don't have this problem. so you can achieve this effect by doing the following:

Robin Price's icon

Cheers, that really helps.