- Home /
How do I get an object to rotate around a different axis based on the raycasts hit angle?
So, I'm working on a building game where instead of it just being blocks, there's other shapes too like ramps, spheres, etc. But I'm having an issue getting objects to rotate according to the surface you're looking at. For example, I'm looking at the wall and hit "R" it will rotate the block on the axis that's perpendicular to the face, Right now it will rotate only on the axis that's perpendicular to the floor. If my question isn't clear enough, here's a drawing that may hopefully explain it a little better.
you use RaycastHit.normal to get rotation axis? if yes then i not understand why you not get right thing.
Your answer
Follow this Question
Related Questions
How do I rotate a circle of objects so that a specific object is in front of the camera? 2 Answers
How to place a GameObject with mesh on a mesh "perfectly" through c# script? 1 Answer
Aligning an Object to a Surface, and Rotating it 2 Answers
problem with object rotation 1 Answer
Pointing object at mouse using raycast only works when object is center screen. 2 Answers