Carrying

Posted By: 82RJZAE

Carrying - 07/20/12 07:02

Hi, any idea how to make a carry code that does not use pX_pick()?

Thanks,
82RJZAE
Posted By: GreenDeveloper

Re: Carrying - 07/20/12 08:07

Code:
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
Posted By: Sajeth

Re: Carrying - 07/20/12 14:10

Well that didn't help.
Posted By: rayp

Re: Carrying - 07/20/12 15:54

Which kind of code do you want to see then ?
Posted By: 3run

Re: Carrying - 07/20/12 18:41

Sajeth@ could you pls upload anything that could help 82RJZAE??
Posted By: rayp

Re: Carrying - 07/20/12 18:55

Iam intrested too
Posted By: Sajeth

Re: Carrying - 07/21/12 09:35

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.
Posted By: rayp

Re: Carrying - 07/21/12 15:32

or u simply disable physic of the object while carring with a mod of the code above. reactivating it on drop.
Posted By: 82RJZAE

Re: Carrying - 07/21/12 16:38

If I'm not correct, that code does not allow for collision detection while you are carrying something. How would you prevent a carried object from intersecting other objects like the wall? C_move?
© 2024 lite-C Forums