A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by MASM_Fanatics » Mon Oct 19, 2009 6:44 am
I want to know how to set a body position and how to detect if it was collide?
-
MASM_Fanatics
-
- Posts: 6
- Joined: Mon Oct 19, 2009 6:18 am
by JernejL » Mon Oct 19, 2009 8:30 am
MASM_Fanatics wrote:I want to know how to set a body position and how to detect if it was collide?
You only set starting location for a body with newtonbodysetmatrix. you don't move the body later - rather you apply the forces (newtonbodyaddforce / newtonbodyaddtorque) in forcetorque callback and then advance simulation with newtonupdate and newton performs collision checks for you, but you can detect collisions during the material callback.
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by MASM_Fanatics » Wed Oct 21, 2009 12:46 am
How to set the callback for each time my mesh is collided?
-
MASM_Fanatics
-
- Posts: 6
- Joined: Mon Oct 19, 2009 6:18 am
by tiresius » Wed Oct 21, 2009 1:43 am
These are very broad questions. Instead of asking them here you should check the Tutorials for 2.0 on the WIKI (link at top of forum page) and study the code in them. Once you have specific questions about a particular problem you're having in your code the people here can help more.
An apple fell on my head and I haven't been the same since...
-
tiresius
-
- Posts: 32
- Joined: Tue Nov 09, 2004 9:15 pm
by JernejL » Wed Oct 21, 2009 4:00 am
MASM_Fanatics wrote:How to set the callback for each time my mesh is collided?
I already answered that - you can detect collisions during the material callback with NewtonMaterialSetCollisionCallback .
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by MASM_Fanatics » Wed Oct 21, 2009 7:00 am
Delfi:
Sorry the function name confuse me. So I haven't check it.
Please appoligize that I am a complete newbie and I am not as expert as you all. So, there is so many thing that I cant understand.
I tried to use NewtonCreateTreeCollision like this,
NewtonCreateTreeCollision,world,lpCollisionFunction
Am I on the right track?
I created 2 body where one of its body is a triangle mesh. I want to test the collision by setting the position so it will collide each other but no luck.
Here is how I set the position
- Code: Select all
glTranslatef,hmn_pos.x,hmn_pos.y,hmn_pos.z
glRotatef,CFLT(0.0),CFLT(1.0),CFLT(1.0),CFLT(1.0)
glGetFloatv,GL_MODELVIEW_MATRIX,addr buff
fMat4fTranspose,addr buff,C2R << My own matrix transpose function
NewtonBodySetMatrix,b2,addr buff
Or I must use NewtonMaterialSetCollisionCallback ?
-
MASM_Fanatics
-
- Posts: 6
- Joined: Mon Oct 19, 2009 6:18 am
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 0 guests