Posted By: IDontLikeSoccer
i made enemy but he not have a gravity - 01/02/10 23:22
Did someone can show me some example gravity code for my enemy script.
Thx!
Posted By: hungryhobo
Re: i made enemy but he not have a gravity - 01/09/10 18:48
using the physics engine
phent_settype(me, PH_RIGID, PH_SPHERE); //what kind of entity?
phent_setmass(me, 5, PH_SPHERE);
phent_setfriction(me, 100);
phent_setdamping(me, 40,40);
phent_setelasticity(me, 10, 10); //set elasticity
put this in the action for your entity. it sets all the physics stuff and of course you can play with the values.
then in your main function put
"ph_setgravity(vector(0,0,-380));"
should be good.
Posted By: Machera
Re: i made enemy but he not have a gravity - 01/09/10 20:01
owww, as far as i know, we cant use physics for characters (like human enemy).
in your character action just write c_move expression. like
c_move(me,movement_vector,vector(0,0,-10*time_step),USE_BOX);
edit: this was c-script topic. i dont know c-script version
Posted By: IDontLikeSoccer
Re: i made enemy but he not have a gravity - 01/10/10 16:16
Thanks guys.
I add some code in my enemy but i have problem my enemy fall down verry fast:
vec_set (temp, my.x);
temp.z -= 10000;
trace_mode = ignore_me + ignore_passable + use_box;
walk_speed.z = -trace (my.x, temp) * time; // i add *time for slowly falling
ent_move(walk_speed, nullvector);
How fix this?
Thx
Posted By: Redeemer
Re: i made enemy but he not have a gravity - 01/10/10 17:04
Read the posts in this thread:
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=301933Blackchuck had a similar problem. Here's how you fix it without using the physics half of the engine. Blackchuck was kind enough to write a Lite-C version of my fix as well, so anyone else with the same problem needs to see this post.