Author Topic: How to attach an oject to the camera  (Read 4865 times)

Offline DougFane

  • byte
  • *
  • Posts: 8
    • View Profile
Re: How to attach an oject to the camera
« Reply #15 on: October 17, 2011, 03:31:18 pm »
I think I know what the issue is, and I don't know if this is what you said, but here it is:

_______   is the gun

<  is the camera

faced straight ahead:

_______
       <

faced 90 degrees:
       |
       |
       ^
       |

ans so on...

I think this is what was making me think it was moving in a circular motion, because the gun appears to recede and advance. Is this what you were referring to, and is altering the pivot point going to solve it?

Offline AGP

  • quad
  • ******
  • Posts: 1638
    • View Profile
Re: How to attach an oject to the camera
« Reply #16 on: October 17, 2011, 04:58:31 pm »
Yes and yes. Does simply calling weapon.setRotationPivot(camera.getPosition()) not work?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12011
    • View Profile
    • http://www.jpct.net
Re: How to attach an oject to the camera
« Reply #17 on: October 17, 2011, 05:20:15 pm »
That would mix camera and object space, which isn't supposed to work very well. Can you post the current value of getRotationPivot()?

Offline DougFane

  • byte
  • *
  • Posts: 8
    • View Profile
Re: How to attach an oject to the camera
« Reply #18 on: October 18, 2011, 08:07:39 pm »
Well first I would like to say, thank you for all the help. Unfortunately, I accidentally overwrote the file of the project I was working on, and post the value that you are asking for. the good news is that while writing test code for the FPS project I was working on, I thought of an alternate game type that seemed a more worthy venture. Rather than create another shooter, I am going for more of a puzzle/adventure type game. The basic premise is that you are trying to get to a spinning monkey head (don't ask) on a platform. You can run and jump like usual, but you can also shoot large red balls which ca be used as stepping platforms. I will make a new post with a zip file attached that contains a fully functional (albeit simple) version of the game.

Thank you for the help Egon and AGP