CliffHanger Posted August 1, 2017 Share Posted August 1, 2017 I understand how to get the surface normal and create an offset, but the fact that we can't seem to use ONLY the surface normal as an orientation for the prop on the ground kind of baffles me... my understanding of the surface normal is that it holds a Vec3 axis adjacent to where the surface is pointing, so wouldn't that be enough? I just see an option for the surface normal but that's the offset as far as I understand. I googled and stumbled on several Unity tutorials to do so from scratch using Quaternion, I just figure there must be a clever way to do it I'm not thinking... multiply normal surface by 360 for each axis? No probably not... this seems more complicated than it needs to be. My understanding is that the surface normal must go in the X axis, then the angle for Y, and lastly a user desired 0-360 Z rotation. Raycast only appears to have hit coords and surface normal. Link to comment Share on other sites More sharing options...
unknown modder Posted August 1, 2017 Share Posted August 1, 2017 Surface normal is just a vector that points perpendicular to the surface. In c# there is a direction to rotation function that can convert the normal into a rotation which should do what you need Link to comment Share on other sites More sharing options...
CliffHanger Posted August 1, 2017 Author Share Posted August 1, 2017 I see RaycastResult.SurfaceNormal.ToHeading() but that's about the only function I could find. Someone else seems to have done their own. http://gtaforums.com/topic/874892-math-direction-to-rotation/ Link to comment Share on other sites More sharing options...
CliffHanger Posted August 7, 2017 Author Share Posted August 7, 2017 Anyone knows about the "direction to rotation function" unknown was talking about? Link to comment Share on other sites More sharing options...
mraes Posted August 7, 2017 Share Posted August 7, 2017 Not SHV.NET but FiveM, still in C#: https://github.com/citizenfx/fivem/blob/b36c2d66ac9cd91d411dc741e084fa43287f5c4a/code/client/clrcore/Math/GameMath.cs#L11 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now