Jump to content

Question about joints


Ywa
 Share

Recommended Posts

Hello. I've been trying to understand how joints work in the engine, so I set myself a simple example:

 

var
 Phys,Mesh, Phys2, Mesh2 : TEntity;

//////////TEST///////////
 Phys := CreateBodyBox( 1,1,1 );
 Mesh := CreateCube( Phys );
 EntityType( Phys, 1 );

 PositionEntity( Phys, mCar.GetPos + Vec3( 0,2,0 ), 1 ); //mCar is another entity

 Phys2 := CreateBodyBox( 1,1,1 );
 Mesh2 := CreateCube( Phys2 );
 EntityType( Phys2, 1 );

 PositionEntity( Phys2, mCar.GetPos + Vec3( 0,0.5,0 ), 1 );
 SetBodyMass( Phys2, 1 );

 CreateJointHinge( Phys, Phys2, mCar.GetPos + Vec3( 0,1,0 ), Vec3(1,0,0) );

 

Basically, I want to see how it works (just like in the wiki example), however when I run the above code, the second box (phys2/mesh2) falls to the ground, without hinge-ing or whatever. I even tried parenting before, but it makes it worse. What am I doing wrong? Thanks.

Link to comment
Share on other sites

Bump.

Boing ! ;)

 

what is mCar.GetPos supposed to return ? a Tvec3 ?

and delphi does not complain when you use the + operator on two Tvec3 ? :blink:

If you have overloaded the Tvec3 add operator, then maybe the problem is there ?

 

This is what i get

post-44-032643500 1283978574_thumb.jpg

Windows 7 home - 32 bits

Intel Quad Q6600 - nVidia GTX 460 1GB - 2 GB RAM

Link to comment
Share on other sites

mCar.GetPos returns a TVec3, yes. I also have an overloaded add operator (..but I haven't got problems using it). Anyways, I'll try your code and post results.

 

Results:

 

post-1240-001595400 1284038230_thumb.jpg

 

EDIT: I have no idea what's wrong. Also, there's some clipped code (on the CreateJointHinge line, can you write it, please). Thanks.

Link to comment
Share on other sites

EDIT: I have no idea what's wrong. Also, there's some clipped code (on the CreateJointHinge line, can you write it, please). Thanks.

Don't worry we will find out what's wrong. I'm currently at work, i'll come back this evening.

 

Hey ! an overloaded add operator for Tvec3 is a good idea :D ! Why did i not have this one ? Will do this too ! :)

 

EDIT :

Your screenshot tells me your engine is not up to date, all those red lines in physics debugging mode is a bug that activates debugging on terrain. You'll need latest cray supercomputer to get decent fps when debugging physics with this version :P.

 

please rerun LESDK updater for 2.40 and try again.

Windows 7 home - 32 bits

Intel Quad Q6600 - nVidia GTX 460 1GB - 2 GB RAM

Link to comment
Share on other sites

From my game engine log, it seems I already have LE 2.40.

 

Leadwerks Engine 2.40
Initializing Renderer...

 

PS: Seems like my engine.dll wasn't updated. Results:

 

- Aside from the fact that the terrain physics aren't debugged anymore (which is a good thing), my problem is still there. Waiting for your reply, thanks :)

Link to comment
Share on other sites

From my game engine log, it seems I already have LE 2.40.

 

Leadwerks Engine 2.40
Initializing Renderer...

 

PS: Seems like my engine.dll wasn't updated. Results:

 

- Aside from the fact that the terrain physics aren't debugged anymore (which is a good thing), my problem is still there. Waiting for your reply, thanks :P

Yes, i know you have 2.4, the physics debugging bug was a 2.4 bug. i just hoped josh fixed something else in latest engine.dll that would explain my 2.4 is working and your's is not :D

 

my code is exactly the same as you, and it works ... :)

     Phys1 := CreateBodyBox( 1,1,1 );
     Mesh1 := createcube(phys1);
     EntityType( Phys1, 1 );

     PositionEntity( Phys1, Vec3( playerposition.X, playerposition.Y+2, playerposition.Z ), 1 );

     Phys2 := CreateBodyBox( 1,1,1 );
     Mesh2 := createcube(phys2);
     EntityType( Phys2, 1 );

     PositionEntity( Phys2, Vec3( playerposition.X, playerposition.Y+0.5, playerposition.Z ), 1 );
     SetBodyMass( Phys2, 1 );

     CreateJointHinge( Phys1, Phys2, Vec3( playerposition.X, playerposition.Y+1, playerposition.Z ), Vec3(1, 0, 0) );

 

now i'm clueless

 

how many newton.dll and jointlibrary.dll do you find on your system ?

Windows 7 home - 32 bits

Intel Quad Q6600 - nVidia GTX 460 1GB - 2 GB RAM

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...