1 registered members (AndrewAMD),
718
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: some a6 physics questions
#15402
04/26/03 06:57
04/26/03 06:57
|
Anonymous
Unregistered
|
Anonymous
Unregistered
|
quote: Originally posted by ventilator: is PH_CYLINDER already implemented as collision hull? i saw it in the manual under physics constants but it isn't listed under collision hulls and it didn't seem to work when i tried to use it.
PH_CYLINDER can be used for testing purposes- it is not officially implemented. The part that is missing (and I would need to double-check that) is Cylinder to Mesh collisions. So if you create a box or sphere entity and set another one to cylinder, they should collide. Because the level is a mesh though, cylinders will fall straight through it.
quote: i would like to set up a car with realistic physics. i know i have to attach the wheels to the chassis per constraints (probably with the PH_WHEEL constraint?).
Use PH_WHEEL for the joint between the wheel and the chassis. Then use phcon_setmotor to apply a torque to the wheel. The wheels then rotate, undergo frictional forces from the ground and thereby drag the chassis along with them. Finding the right numbers for mass, friction, damping, torque, etc. can be difficult. Also make sure your setmotor parameters are not too large or the wheels will start to slip. There is one unresolved issue with the axle bending when the chassis is too heavy, or the wheels spin too fast.
|
|
|
Re: some a6 physics questions
#15403
04/26/03 07:01
04/26/03 07:01
|
Anonymous
Unregistered
|
Anonymous
Unregistered
|
Would it be possible to use the physics engine for a car or other complex/multiple-part object using the one object physics in commercial edition?
P.S. @Ventilator: How did you get your update to A6 already?
|
|
|
Re: some a6 physics questions
#15404
04/26/03 07:07
04/26/03 07:07
|
Anonymous
Unregistered
|
Anonymous
Unregistered
|
quote: Originally posted by Fredmaster: Would it be possible to use the physics engine for a car or other complex/multiple-part object using the one object physics in commercial edition?
Not in the way I described below. For the commercial edition it would make more sense to use a single MDL car model including wheels and turn this into a physics entity. Then add forces and torques to it for accelerating/turning.
|
|
|
Re: some a6 physics questions
#15405
04/26/03 07:36
04/26/03 07:36
|
Joined: May 2002
Posts: 7,441
ventilator
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2002
Posts: 7,441
|
quote: Because the level is a mesh though, cylinders will fall straight through it.
that's exactly what i experienced. so i have to use PH_SPHERE instead of it for the wheels of my car. should work too...
if i want the car to go around a curve, do i just need to turn the front wheels? or do i need to apply torque/motor (front wheel drive) so that they "pull" the car around the corner?
... the physics engine is really cool! in my experiments i had over 200 active physics entities and didn't have any jerks or any noticeable framerate drop. i didn't expect that!
quote: P.S. @Ventilator: How did you get your update to A6 already?
ordered yesterday, got it today!
|
|
|
Re: some a6 physics questions
#15409
04/26/03 17:34
04/26/03 17:34
|
Joined: May 2002
Posts: 7,441
ventilator
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2002
Posts: 7,441
|
this is some working code from my tests: code:
action sphere { my.shadow=on; phent_settype(my, PH_RIGID, PH_SPHERE); phent_setmass(my, 5, PH_SPHERE); phent_setfriction(my, 70); phent_setelasticity(my, 50, 10); phent_setdamping(my, 20, 20 ); temp.x=cos(camera.pan)*cos(camera.tilt)*300000; temp.y=sin(camera.pan)*cos(camera.tilt)*300000; temp.z=sin(camera.tilt)*300000; phent_addforcelocal(my,temp,nullvector); } string mdl_sphere=<sphere_0.mdl>; function emit_sphere() { temp.x=camera.x+cos(camera.pan)*cos(camera.tilt)*100; temp.y=camera.y+sin(camera.pan)*cos(camera.tilt)*100; temp.z=camera.z+sin(camera.tilt)*100; ent_create(mdl_sphere,temp,sphere); }
on_mouse_left=emit_sphere;
it emits spheres from the camera position!
|
|
|
Re: some a6 physics questions
#15410
04/27/03 07:00
04/27/03 07:00
|
Anonymous
Unregistered
|
Anonymous
Unregistered
|
Thanks Dude, There's realy not much working script examples in the manual and none template scripts for the new physics engine(as far as I know) I added some gravity and had to end the loop after one model was emited (com edition)
|
|
|
|