|
Re: Physics help needed for controls similar to Half-Life 2
[Re: Robogamer]
#442323
06/18/14 07:31
06/18/14 07:31
|
Joined: Mar 2011
Posts: 3,150 Budapest
sivan
Expert
|
Expert
Joined: Mar 2011
Posts: 3,150
Budapest
|
in your main user interface while loop check if mouse is clicked check is there a mouse_ent check whether it is a pickable entity or not (you can use a FLAG for it, set on level design) use vec_for_vertex or vec_for_bone to position this item entity to your character hand (even if it is invisible)
on left click check whether the character has an item in hand if yes, start throw animation of your character when it is finished after some frames, set a speed to the item decelerate item speed, apply gravitation, until hits something, or use physx
on right click check whether the character has an item in hand if yes, detach from character, and set a gravity to the item
|
|
|
Re: Physics help needed for controls similar to Half-Life 2
[Re: sivan]
#442822
07/03/14 21:36
07/03/14 21:36
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
User
|
User
Joined: Mar 2012
Posts: 927
cyberspace
|
one of my competition entries attached and threw an object , it was called "moon craft" although I forgot to limit the frame rate to 60 fps wich rendered my forces absolute , there is code within it you could use , I used joints to do what you describe. ..
Compulsive compiler
|
|
|
Re: Physics help needed for controls similar to Half-Life 2
[Re: ventilator]
#442882
07/05/14 10:53
07/05/14 10:53
|
Joined: Jul 2007
Posts: 619 Turkey, Izmir
Emre
User
|
User
Joined: Jul 2007
Posts: 619
Turkey, Izmir
|
You can use pXent_setvelocity and pXent_addvelcentral. for example;
VECTOR hold_target;
VECTOR my_kick;
.....
if (event_type == EVENT_RIGHTCLICK)
{
while(mouse_right==1)
{
if(!mouse_left)
{
vec_set(hold_target,vector(20,0,0));
vec_rotate(hold_target,camera.pan);
vec_add(hold_target,camera.x);
vec_sub(hold_target.x,my.x);
vec_scale(hold_target.x,10);
pXent_setvelocity(my, vector(hold_target.x, hold_target.y, hold_target.z));
}
else
{
my_kick.x=10;
my_kick.y=0;my_kick.z=0;
vec_rotate(my_kick,camera.pan);
pXent_addvelcentral(my, vector(my_kick.x, my_kick.y, my_kick.z));
break;
}
wait(1);
}
}
|
|
|
|