need physic

Posted By: MagZu

need physic - 03/08/06 20:01

i need some physics
like so that the wall can get smashed and crates so i can place crates up on each others and then get them to collaps
that with the wall is that i want is like a astroide or something cannon or what i am going to have let us say the cannon so that the cannon ball hits the wall and the wall collaps
can someone help me with that????
ps.if you have some good physic post it here
Posted By: MagZu

Re: need physic - 03/08/06 21:21

ow comeone physic script at least a crate physic
Posted By: MagZu

Re: need physic - 03/08/06 23:28

Someone?
Posted By: Havoc22

Re: need physic - 03/09/06 02:14

I think your best bet is to look in the manual and read up on the physics section. Maybe download a few open source physics examples.
Posted By: MagZu

Re: need physic - 03/09/06 14:03

and where do i get physics just for let say a crate
Posted By: Anonymous

Re: need physic - 03/09/06 14:52

Hi!

Here's the beginning of your physics:
Read all about the "phent_..."-methods in your handbook.

Code:

entity* crate;

function main {

level_load("your level with a simple hollow-cube around the origin");
wait(3);

crate=ent_create("crate.mdl",nullvector,null);
phent_settype( crate, PH_RIGID, PH_BOX );
phent_setmass ( create, 10, PH_BOX );
phent_setfriction ( crate, 1 );
phent_setelasticity( crate , 2, 2);
ph_setgravity ( vector(0,0,-368) );

while(1){
wait(1);
}
}


Posted By: MagZu

Re: need physic - 03/09/06 15:10

i get error
< entity*^crate;>
crate_physic.wdl 1:1 Error(135): Double definition crate pointer function

<crate=ent_create(@4.nullvector.null)>
crate_physic.wdl 8:0 Error(73): Read only crate

<phent_setmass(create.10.PH_box)>
crate_physic.wdl 10:0 Error(63): Parameter unknown create

how do i slove that
Posted By: MagZu

Re: need physic - 03/09/06 15:13

does the crates get like in this demo:
http://newtondynamics.com/downloads/NGDdemo.zip
Posted By: Anonymous

Re: need physic - 03/09/06 15:23

Hi!

First you have to learn C-Script to understand the errors - so please try some simpler things first...

- the first error means that you somewhere in your code already defined an object/function with the name "crate".

- the second error depends on the other "crate"-object (it's readonly).

- the last error is a spelling-mistake - try "crate" not "create" - sorry - wrote the code without editor/test.

mercuryus

ps: the link you posted is the NEWTON physics-engine. I've heard it's better but I don't know it...
Posted By: MagZu

Re: need physic - 03/09/06 15:50

kk i can try that:)
Posted By: MagZu

Re: need physic - 03/09/06 16:55

the crates does not have physic with that script how does i fix that so it has physic
Posted By: indiGLOW

Re: need physic - 03/10/06 10:08

Its just missing the phent_enable(my,1) to turn the physics on.
Posted By: MagZu

Re: need physic - 03/10/06 13:50

dosent work
Posted By: Anonymous

Re: need physic - 03/10/06 14:39

Hi!

I think phent_enable(my,1) isn't nessesery within this simple case (I've nerver used it and it works), but as answered in an other task: you'll need commercial or pro-version to use 1 (com) or more (pro) physical objects.
Otherwise use the newton-engine. It's well documented and i think you can read?

mercuryus
Posted By: MagZu

Re: need physic - 03/10/06 15:07

Mercury you got that script we talked about last night?
Posted By: MagZu

Re: need physic - 03/10/06 16:35

how do i fix that code so i get it like a crate

Code:
___________________________________________________________________

var earthgravity[3] = 0,0, -300; // The amount of Gravity Force
entity* boulderm;

action obelisk //If You Own Commercial Edition, keep the action like this
{
wait(1);
}

action obelisk //If You Own Professional Edition, keep the action like this
{
phent_settype(my, PH_RIGID, PH_poly); // sets the object within the physics engine
ph_setgravity ( earthgravity );
phent_setmass(my, 120, PH_BOX);
phent_setfriction(my,7);
phent_setelasticity(my, 10, 10);
}
______________________________________________________________________
Posted By: indiGLOW

Re: need physic - 03/10/06 19:34

Here's my code:

Code:

ph_setgravity (vector(0,0,-300));
phent_settype(my, PH_RIGID, PH_BOX); // sets the object within the physics engine
phent_enable(my, 1); // I guess this is set to 1 by default when you set type?
phent_setmass(my, 5, PH_BOX);
phent_setfriction(my,25);
phent_setelasticity(my, 30, 10);



Try that
Posted By: MagZu

Re: need physic - 03/10/06 21:31

thx for your help it worked
Posted By: indiGLOW

Re: need physic - 03/11/06 13:06

Np - The main problem I encountered with your code was that it appeared the crates were to heavy, this seems to be a recuring problem, I had it with my car physics, the chasis was much to heavy and the wheel constraints don't seem to be designed for huge weights. ...Of course its just a simple case of moving a few decimal places around and scaling your weights accordingly....

Anyway glad it worked
© 2024 lite-C Forums