reepblue Posted February 7, 2020 Share Posted February 7, 2020 Hi All, I'm hoping somebody who's a bit better at math may be able to help with this. I'm trying to get math down for reflections off a surface based on the direction of the entity. My current code which pretty much does the same thing as aligning the entity to the surfaces normal. auto contactnorm = tr.vNorm; auto rot = GetEntity()->GetRotation().Normalize(); auto newDir = Vec3(contactnorm).Reflect(rot); GetEntity()->AlignToVector(newDir, 2); I would appreciate the help. 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted February 8, 2020 Share Posted February 8, 2020 It is very strange that you are treating rotation as a vector. Instead you probably want to transform the vector 0,0,1 from entity to global space. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted February 8, 2020 Author Share Posted February 8, 2020 The AlignToVector bit was due to success of the ball bouncing off with the normal of the surface as it's new direction. Thanks. I'll try again with Transform::Vector(). Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
reepblue Posted February 14, 2020 Author Share Posted February 14, 2020 Using the direction of the surface is fine for right now and the bouncing implementation seems more work than for what it's worth. I'm probably gonna come back to this if I decide to add reflection lasers, and I think that'll be easier to implement. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.