Linus Posted September 18, 2012 Posted September 18, 2012 I need to put constraints on the forces that are exerted on a body at any point in time. Is there a way to get the collision data calculated by the engine, but write my own collision response (for a single body)? Are there other ways to achieve the same result?
cor Posted September 24, 2012 Posted September 24, 2012 Let me explain a little bit more. We are working on a flight simulator. A motion platform will be connected to the computer and Unigine is used to render the world. It is very important for us that we have full control over the motion of the aircraft. This for several reasons. One of them is the fact that we are creating our own aircraft model. Another one is that we have to decide ourselves which motion can be accepted at each moment by the motion platform. The standard physics engine will sometimes create motions that can not be simulated by the platform. To overcome motion sickness we need aircraft motion in Unigine that has a specific relation to the platform motion. Furthermore we want to use a special prediction algoritme to improve the experience. For this we also need full control about the aircraft motion. On the otherhand we need collision detection to be able to react on collisions. Note that we are not evelopping a flight simulator for pilot training, but for the entertainment market. So collisions are allowed ;-) So how can we achieve this? To use collision detection we need to use rigid bodys. Right? And these object will automatically react on collisions. Right? How can we prevent the collisions will automatically result in object movements changes? We would like to use the collision information and calculate object movements ourselves using our own physics model and taking into account all other needs and contraints. If anyone has an idea how to achieve this, pleae let us now.
fonta.romain Posted September 24, 2012 Posted September 24, 2012 Perhaps you could use only collision callbacks (see SDK example) and do your physics calculations on your own. Don't know if it's possible, but using physics of Unigine will make harder IMHO to be 100% reliable to your motion simulator.
cor Posted September 24, 2012 Posted September 24, 2012 That is what we would like to do: ... use only collision callbacks (see SDK example) and do your physics calculations on your own. But how can we prevent Unigine to do the calculations and prevent it to move the object.
manguste Posted September 26, 2012 Posted September 26, 2012 If you want to move nodes according to your algorithm and only get collision point from Unigine, you need to do the following: 1.For each object you want to collide add a PhysicalTrigger. Choose an approximation shape for it. PhysicalTrigger is used to report collisions with other objects. 2. Set up collider shape for an object in 1 of the following ways: Create s special (simplified) collider surface. It is created for a model to avoid scenarios when a PhysicalTrigger has to intersect with high-poly surfaces. Assign BodyDummy and an approximation Shape for an object. This is a fake body that does not react to gravity, etc., so you can safely use it for your purpose. 3. After you've added a collider surface or assigned BodyDummy, you need to set up exclusion masks for it and PhysicalTrigger not to react on each other. 4. Add your functions as enter callbacks of PhysicalTrigger.
Linus Posted October 3, 2012 Author Posted October 3, 2012 I have one more question about this. I have followed your steps and it works fine for collisions with other bodies. However, unlike BodyRigid objects, the physical trigger doesn't detect collisions with objects that have a collision surface but no body. For example, I can't detect collision with the terrain. How should I solve this? Should I use BodyDummy and contactCallbacks instead of PhysicalTriggers?
Linus Posted October 4, 2012 Author Posted October 4, 2012 I solved the problem by using a BodyRigid instead of a PhysicalTrigger. :) An explanation of what I did in the same format as the PhysicalTrigger solution above: 1. For each body (let's call it B) that I want to write my own collision reaction algoritm for, I create a (seperate) RigidBody (let's call it T). T will serve as a collision detector for B. 2. I make sure that I copy the position, rotation, linear velocity and angular velocity from B to T on each flush. I do this manually, not by making B parent of T, because I don't want T to change the physical state of B. 3. I set the exclusion masks of B and T so they do not collide to eachother. 4. I use contact callbacks of T which will execute my own collision reaction algoritms. Note that other BodyRigids will react to T. In my case this is actually a benefit, because I use a DummyBody for B and T makes sure that other object react to it as if it was a RigidBody.
Recommended Posts