dongju.jeong Posted November 14, 2018 Share Posted November 14, 2018 (edited) Like collision handling of the body contact example, should not the physics trigger not modify the node within the callback function? So, I can't modify the node using the functions below in the callback function for modify node? float getContactDepth(int contact) Math::vec3 getContactNormal(int contact) Ptr<Object> getContactObject(int contact) Math::Vec3 getContactPoint(int contact) Ptr<Shape> getContactShape(int contact) int getNumContacts() then, what does it usually do in a callback function? Edited November 14, 2018 by dongju.jeong Link to comment
fox Posted November 16, 2018 Share Posted November 16, 2018 Hi Dongju, Right, you shouldn't modify nodes within a physical callback. Please take note, that if you set any physics-based callbacks in the flush() or use PhysicalTrigger, they cannot be executed immediately, as the rendering process is already in action and they can violate it. If there is one more physics iteration to go, they are executed before the next flush(); if not, before the next world script update(). In a physical callback you normally operate with bodies, set velocities, add impulses, do the physical kind of things. If you want to reposition or transform, create or delete nodes that are returned by your physics callback, the workflow is as follows: put them into some array and then perform all necessary actions in update(). As for the functions listed by you actually do not modify a node, they're all just getters, so you can use any of them. Thank you! Link to comment
Recommended Posts