- Home /
Having an issue with child rotation working correctly, any help?
Referring to the picture below, the purple square is my player game object. The black rectangle is supposed to represent a gun.
Currently the player will rotate depending on the cursor's position, and can move around the scene with WASD. I want the gun object to stay attached to the player whilst the player moves around and such. I tried making the gun a child of the player, however the rotation only worked for 180 degrees, then the gun would flip over to the opposite side of the square.
I'm a bit lost on this one. I thought about writing a separate script for the gun's behaviour, but I'm sure there's a much easier way to settle this issue. Any help would be greatly appreciated. Thank you.
Answer by tormentoarmagedoom · Jun 17, 2018 at 10:42 AM
Good day,
I dont understand what you mean with "however the rotation only worked for 180 degrees, then the gun would flip over to the opposite side of the square."
If you make the gun, a chilkd of the player, it become part of the player, and will move as a player "part", like an arm or a leg. It will stay quitet in the player reference. So, I don't get why is not working for you.
Do you have any scriipt trying to move the weapon or something?
Bye
Your answer
Follow this Question
Related Questions
Sync child objects over network 1 Answer
How to achieve Luftrauser like airplane gameplay in 2.5D 1 Answer
How to change rotation of a child GameObject around its own axis instead of that of the Parent? 1 Answer
Lookrotation for TwinStick Shooter 0 Answers
How would you set a camera lerp position with code not a child object? 1 Answer