Can't get physics to work!

Posted By: anrkies

Can't get physics to work! - 02/05/04 07:12

I have tried almost every way of making the physics to work. But I don't get what’s wrong. I have made a ball and attached a action to it:

var earthgravity[3] = 0,0, -386;

action phys
{
phent_enable(my, 1);
ph_setgravity(earthgravity);
phent_settype(my, PH_RIGID, PH_ball);
}

When I run this script I get an error message that says that none of the ph: s in the action exists. So I wonder if I must include some file or perhaps start the physics engine to work. Please help!

\\Niklas
Posted By: ScriptMaster

Re: Can't get physics to work! - 02/05/04 07:23

Just a guess but you wouldn't happen to be using A5 or an edition less than pro or com would you?
Posted By: qwerty823

Re: Can't get physics to work! - 02/05/04 08:00

or using the demo version, which is Extra, I believe.
Posted By: Marco_Grubert

Re: Can't get physics to work! - 02/05/04 11:47

First call phent_settype(), then call phent_enable().
Posted By: iprogramgames

Re: Can't get physics to work! - 02/05/04 15:31

Here is your altered code which I have verified works:

action phys
{
var earthGravity[3];// = 0,0, -386;

earthGravity[0] = 0;
earthGravity[1]=0;
earthGravity[2]=-386;

phent_settype(my, PH_RIGID, PH_ball);
ph_setgravity(earthgravity);
}

Here is some code to make the entity act more like a ball.

action physicsBall
{
var earthGravity[3];// = 0,0, -386;

earthGravity[0] = 0;
earthGravity[1]=0;
earthGravity[2]=-386;

phent_settype(me, PH_RIGID, PH_SPHERE);
phent_setfriction (me,100);
phent_setelasticity ( me, 50, 0 );
ph_setgravity( earthgravity );
}

Notice I have made the variable earthGravity a local variable. You may wish to make it global but this allows you to simply cut and paste the code.
Posted By: Superku

Re: Can't get physics to work! - 02/05/04 21:49

If you own A6 Com/Pro, then your only mistake was that you forgot to set its mass (if its mass is zero, it won't fall down).

phent_setmass ( me, 30, PH_BALL); // 30 kg

Darth Felix
Posted By: anrkies

Re: Can't get physics to work! - 02/06/04 04:51

I'm using A5 pro edition right now. And I will try this script as soon as I come to my other home. Where I have A5 installed.
Posted By: ScriptMaster

Re: Can't get physics to work! - 02/06/04 05:09

Here's you problem then A5 Pro doesn't support Physics, Only A6 Pro or Com does.
Posted By: anrkies

Re: Can't get physics to work! - 02/06/04 21:46

Ok I will have to upgrade then. Thanks for your help!
© 2024 lite-C Forums