Search Unity

2 aim cursor in one screen like virtua cop

Discussion in 'Scripting' started by kebaboom, Nov 7, 2006.

  1. kebaboom

    kebaboom

    Joined:
    Nov 2, 2006
    Posts:
    4
    Hello there I want to ask how to put 2 cursor in one screen one for mouse and another for keyboard, example game like virtua cop or house of the dead. Then how the input can shoot the object. Any suggestion? Sorry for my bad english
     
  2. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,268
    It's easy enough, I would think (but I am no expert!). The second cursor is just an object, probably rendered orthographically, that has a simple script attached that controls its movement based on keyboard input. You cast rays through it to "shoot."

    I don't know what you'd do if you wanted two simultaneous mice, though. Games like Ambrosia's pop-pop benefit a lot from this.
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You'd want to use GUI textures, not regular 3D objects. You could easily adapt the 2D cursor script I put on the wiki for this. Take out the stuff you don't need, then make another copy with keyboard controls instead of mouse controls.

    --Eric
     
  4. kebaboom

    kebaboom

    Joined:
    Nov 2, 2006
    Posts:
    4
    thanks for marble and eric. useful info.
    Another question if i want to click or press shoot button at the target, can I just hit the enemy without
    cast ray and projectile?
     
  5. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,268
    Technically, you could just override OnMouseDown() if your "enemy" objects had colliders, if you were only using one cursor. But with two you'll probably want to cast an (invisible) ray to see if your enemy gets hit, for either.