Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

[SOLVED] How do I rotate a gun so that the player picks it up and holds it right.

edited May 2014 in Technical Q&A
I have a gun on the floor and I need the Player to pick up the gun and hold it on the right hand. It works but the gun is not held on the hand in the right way. Of course I am not talking about the player to grab the gun with his fingers but I just want the gun to be placed as if he is holding it. The player uses Mecanim animation and i have Bone transforms the left and right middle fingers. Any help?


Comments

  • I've had to do this for torches, and it's actually a simple matter of doing a couple object: transform actions after the player picks up the gun.

    So, run the game in the editor in windowed mode so you can move things around in the scene window. Play the game, and once the player holds the gun, press the pause button in the editor. Now, all you need to do is go into the scene window and move and rotate the gun so that it looks like he's holding it correctly. Once you've done that (with the game still paused), copy down the gun object's position and rotation x y z coordinates (or take a picture with your phone, that's how I do it).

    Then, end the game, add in two object: transform actions after the player picks up the gun, and set one action as translate to: xyz position, and the other action as rotate to: xyz rotation.

    That should do it!
  • wow that's soooo logical and clever thanks @skitt2501 will try it and let you know!
  • edited May 2014
    @skitt2501 :( did as you said problem is  that AC wont accept the gun (model) in the Moveable object slot! crazy

    when  i click to select it I get no models available and when i drag it into the slot it wont accept it.
  • Have you attached the appropriate script to the gun model? (I think it is called Movable.cs or maybe Movement.cs, I don't know from the top of my head and can't look it up right now).
    If you do, it will show up in that selection window ...
    Cheers,
    orrence.
  • @orrence Actually i hadn't and now it works! thank man and you too @skitt2501
  • Oh yeah sorry, forgot to mention that! 
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!