Crystal Space
Welcome, Guest. Please login or register.
October 23, 2014, 10:25:33 am

Login with username, password and session length
Search:     Advanced search
9010 Posts in 2044 Topics by 8798 Members
Latest Member: Williamchavez
* Home Help Search Login Register
+  Crystal Space
|-+  Associate Projects
| |-+  CEL Discussion
| | |-+  Can I Use Cel for Car Movement and Collision
« previous next »
Pages: [1] Print
Author Topic: Can I Use Cel for Car Movement and Collision  (Read 4197 times)
Nightman
Guest
« on: May 01, 2006, 02:18:12 am »

Hello

I have been started with car race game and there some problems
 
* when i use pclinemovement for collision , i can't use the function
       PcMechanicsObject->AddForceDuration (.....)  the program crash

and without  pclinemovement  i don't know how detecte collision

please help me
thanks

Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: May 01, 2006, 06:30:40 am »

Hello

I have been started with car race game and there some problems
 
* when i use pclinemovement for collision , i can't use the function
       PcMechanicsObject->AddForceDuration (.....)  the program crash

and without  pclinemovement  i don't know how detecte collision

please help me
thanks



pclinearmovement and mechanics don't go together. You use either linear movement or else mechanics. They are totally different and incompatible systems. You first have to decide if you want to go with full physics (in which case you should use mechanics) or else use approximations (linear movement). In case of a car game physics is strongly recommended. To check collision detection the pcmechobject property class will send out 'pcdynamicbody_collision' messages to the behaviour of the entity.

Greetings,
Logged
Nightman
Guest
« Reply #2 on: May 01, 2006, 03:41:02 pm »

Thanks Very much for your help;

I'm using  level_entity to deal with map file , and Car_entity to deal with car ,

The code Like :

{  //  for Level
………

csRef<iPcMechanicsSystem> pcmechsys = CEL_QUERY_PROPCLASS_ENT (level_entity,PcMechanicsSystem);
pcmechsys->EnableQuickStep ();
pcmechsys->SetStepTime (0.02f);

csRef<iPcMechanicsObject> pcmechobj = CEL_QUERY_PROPCLASS_ENT (entity_entity,iPcMechanicsObject);
csPlane3 ground (0, -1, 0, -1);
pcmechobj->AttachColliderPlane (ground);
pcmechobj->MakeStatic (true);

……
}

{  //  for car

………

csRef<iPcMechanicsObject> pcmechobject = CEL_QUERY_PROPCLASS_ENT (Car_entity,iPcMechanicsObject);

pcmechobject->AttachColliderBox (csVector3 (.4f, .3f, .3f), csOrthoTransform ());
……
}

the problem is no coliision so the car fall down

Can you help me please  ..


Logged
Nightman
Guest
« Reply #3 on: May 06, 2006, 02:39:56 am »

hello

* if Iam using linemove->initcd( ...  ) for collision detection how i can use Addforce()  function to simulate car movement
 
please help me

Greetings
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #4 on: May 08, 2006, 05:23:31 am »

linmove is not really very suitable for this. You should use the mechanics classes. linmove has no AddForce() method. Check the API on available methods.

Greetings,

Logged
cfraz89
Guest


Email
« Reply #5 on: May 08, 2006, 08:14:22 am »

Hi Nightman,
I'm working on a car game too, Automanic (http://automanic.sf.net). I guess you discovered making a car game gets pretty tricky.

First off, pclinmove and pcmechobject dont mix. The way mechobject works, is that Crystal space sends information to ODE about the positions of objects, ODE does the work in its own physics world, and CS updates the positions of the meshes based on this. So using pcmechobject, you cant move anything by moving the meshes, you have to work on their mechobjects or rigidbodies. Linmove and its collision system works by moving the meshes around. The other thing is that it will be nearly impossible for you to get proper physics with linmove, its only meant for moving people.

About the collision with the ground, I'd advise you to use pcmechsys->GetDynamicSystem()->AttachColliderPlane(). MakeStatic on an object never seems to work for me, the cars sink through the ground like quicksand.

You might want to look at the Automanic source code to see how i hacked up things, although the code is a bit messy. Feel free to use the models if you want, too
Logged
Nightman
Guest
« Reply #6 on: May 09, 2006, 10:25:03 pm »

Hi cfraz89

thanks for your reply , i'm will discover your project

Greetings
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 7.274 seconds with 15 queries.