Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Push drag/throw objects with the FPSWalker prefab

Discussion in 'Scripting' started by Filurmager, Apr 6, 2008.

  1. Filurmager

    Filurmager

    Joined:
    Apr 6, 2008
    Posts:
    1
    I'm trying to make my FPSWalker being able to to do three things.

    1) Pushing objects when i walk into them, instead of walking on top of them.

    2) Be able to use the mouse to drag and throw objects in my scene. (just like the Shadow Room demo, but from an 1. person perspective)

    3) How do i get the mouse cursor to stay at the center of the screen?

    EDIT: Got the drag function to work by creating an empty gameobject with a drag rigidbody script and attaching it to the FPSWalker. Now I just need to figure out how to get it to throw the object when the mousebutton is released.

    EDIT 2: Got the pushing to object function to work by assigning a Box Collider to the same empty Game Object that i assigned the DragRigidBody script to.

    I have very little experience with scripting, so please explain carefully :)

    Thanks in advance.
     
  2. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    Have a forum search for grab gun/ grabbable gun/ gravity gun(one of those) :p Joachim made a great version.

    And then look for a Pushrigidbodies.js script on the forum and maybe the wiki

    HTH

    AaronC