Jump to content

Teleport BodyCloth


photo

Recommended Posts

I'm trying to figure out how to properly teleport a BodyCloth. We use this for flags attached to vehicles and the Physics system correctly waves the flag in the wind when the object moves. However, the instructor can pick up any vehicle and relocate it elsewhere in the scene, in which case the flag goes out of control trying to simulate it moving at 1000m/s across the world. Is there some specific function I can call to reset the flag simulation? Or is that only posible by recreating the flag from scratch?

Two pictures, first the correct flag behaviour when moving at constant speed:

Flag1.jpg.1327a6349ce56bb55a6cbb497a9c4ad5.jpg

And next what happens when we teleport the flag, looks like this for a couple of frames before it stabilises at the new position:

Flag2.jpg.dbfb7062f998f3b52b528d204fa080ff.jpg

Link to comment

Hello! 
You need transform body_cloth after transform object:

Mat4 transform = setTo(...);
node_object->setTransform(transform);
body_cloth->setTransform(transform); // or transform * previous_local_body_transform (if body have it's own transform)

 

Link to comment

We tried that, but when we call BodyCloth::setTransform per frame the flag loses all it's velocity. It still reacts to wind but not to the motion of the parent object itself anymore. And if we only call BodyCloth::setTransform when teleporting nothing changes, the flag still goes nuts.

What we want to achieve is not just the flag moving by the wind but also by the motion of the parent object. And the two should be able to cancel each other out as well, so with a wind of 10m/s and the object moving also at 10m/s in the same direction, the flag should not wave. This works correctly if we only set the transform on the parent object (e.g. flag_pole_object->setTransform) but if we move the flag itself (body_cloth->setTransform) it only animates by wind, so the flag waves even the object velocity matches wind speed and direction.

Link to comment

Bemined

A small test scene will be very useful here. Could you please send us your mesh and logic that controls bodies movements (resets the positions)?

You also don't need to call BodyCloth::setTransform every frame - that would not work. You need to call it only once when the final position is selected and no more movements is expected. I'm afraid, there is not so many options available to mix the non-physics and physics movements.

Construct a new object at the new respawn point is not an option?

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Thanks for the test scene. It looks like the joints itself are keeping their positions (even if we reset them manually).

Some additional time is required to understand if this is bug or expected behavior. More likely devs would be able to take a closer look into it after the new release. 

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
  • 1 year later...

Hi Maarten,

Unfortunately, our research has ended in nowhere. Actually, it was pointing to the JointParticles mechanics for caching particles positions, but the amount of changes that we need to refactor in order to resolve this is quite big.

As far as we understand it's only a visual bug, that's why we postponed our attempts to fix it (none of the obvious workarounds that we tried helped).

If we didn't understand the priorities right - could you please tell us how critical is that issue for your team? We can try another session of debugging after 2.15 release.

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...