Crashy wrote:One last question and I'll let you work on newton 3
the line "contactOut.m_userId = GetUserDataID();" erase the id of the sub collision by the global id value of the compound collision.
Is this intended or still in work in progress?
Oh yes that is a bug, that code check check that the chield shape is not a compound first, andif ti is it reycast teh chidl shape and return, I will fix it.
on this
- Code: Select all
unsigned _CDECL Raycast::newtonRaycastPreFilter(const NewtonBody *body, const NewtonCollision *collision, void* userData)
{
// get our object!
Raycast* me = (Raycast*)userData;
Body* bod = (Body*)NewtonBodyGetUserData( body );
const World* world = bod->getWorld();
Collision* coll = new Collision(collision,world);
delete coll; // <------------------here, when deleting the object, memory corruption
return 1;
}
I do not undertand what that code is doing, but wite teh collsion instance, teh collison you use to creat a body is not the sam ethat is assigned to the body.
each body get its own copy of a collsion intance and it is teh collsion intance that share teh assest of the shape.
Before all teh per instance and and the per shape data was in teh same object bu that make it defficult to add properties to collsion shape.
for example before making a compoind with teh same shape resues was impossible, bu now is very eassy.
teh will also eliminate the Proxy collsion of teh scene collsion since each collsion how is a proxy. besacally teh collison intance is the Proxy and the collision modifres combine int one and applyed to all collsion shapes.
I have bib plan for collsion intances, so far it is only replacyin corrent funtionality.
but later I will add the scale. and a funtion in newton that has being bothering me for a while.
That is the concept of inertial frame.
Although the engine is bases on the three newtonian law of motion: force equal mass time acceleration, action reaction, Inertia
On the inertia law, teh law say body is in equalbriium when the linear velocity remaind constant. The other way to say that law is "A body is in equelibrium when is a rest on an inertial frame"
so in core 200 an previsu only teh world was cosidered an inertia frame. but with collsion instance, a body any parte of a chile shape can be an inertia frame.
for this the collsion intance will have a variable for linear and angular velocity.
so the say for example you make a compound collision that represnt a ship, insise thet sheep ther are many parts, many of them can have local velocityes, an dteh ship can be moving.
say an elevator go up, teh can be doen by moving teh local shape and setting the velocity of teh local shape,
any object in the way of the elevator that was at equlibrium will ge teh new velocity shabeg and react until teh objec
itself goes to rest is the elevator velocity is also contact. wh eh elevator stops, again the local velocity change whi will be a change in any body accelration an dteh bady react again.
for a long time I have being trying to formalize this engine funtionality and not as a client functionality.