4 registered members (dBc, clonman, TipmyPip, 1 invisible),
18,936
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Carrying
[Re: 82RJZAE]
#404966
07/20/12 08:07
07/20/12 08:07
|
Joined: Nov 2011
Posts: 29
GreenDeveloper
Newbie
|
Newbie
Joined: Nov 2011
Posts: 29
|
BMAP* pointer_tga = "pointer.tga";
VECTOR temp;
function mouse_startup()
{
mouse_mode = 2;
mouse_map = pointer_tga;
while (1)
{
vec_set(mouse_pos, mouse_cursor);
wait(1);
}
}
function pick_or_drop()
{
wait (1);
my.skill1 += 1;
if ((my.skill1 % 2) == 1) // clicked the object?
{
while (mouse_left) {wait (1);} // wait until the player releases the left mouse button
while (!mouse_left) // move the object until the player presses the mouse button again
{
temp.x = mouse_cursor.x;
temp.y = mouse_cursor.y;
temp.z = 200; // move the object 200 quants below the camera, play with this value
vec_for_screen(temp.x, camera);
vec_set (my.x, temp.x);
set (my, PASSABLE);
wait (1);
}
}
else // drop the object here
{
vec_set (temp.x, my.x);
temp.z -= 3000; // trace up to 5,000 quants below the player
// make sure to drop the object on the ground
my.z -= c_trace (my.x, temp.x, IGNORE_ME + IGNORE_SPRITES + IGNORE_MODELS + USE_BOX);
reset (my, PASSABLE);
}
}
action click_and_move()
{
my.skill1 = 0;
my.emask |= ENABLE_CLICK;
my.event = pick_or_drop;
}
in aum85
"Actually we are all Guybrush.." GreenDeveloper
|
|
|
Re: Carrying
[Re: rayp]
#405019
07/21/12 09:35
07/21/12 09:35
|
Joined: Apr 2008
Posts: 650
Sajeth
User
|
User
Joined: Apr 2008
Posts: 650
|
Didn't get around to work with PhysX much, but my (un-)educated guess would be to directly set the position of the object in front of the camera and then connect it with a PH_BALL constraint to the px actor used as player. The code snippet posted above is useless as it isn't using the physics system.
Last edited by Sajeth; 07/21/12 09:36.
Teleschrott-Fan.
|
|
|
|