Rick Posted March 8, 2012 Share Posted March 8, 2012 Has anyone ever made a MoveEntityTo type of function to move an entity from it's currently location to another entities location at a given rate? It would basically be just like PointEntity works but with position instead of rotation? Spending my efforts in another place in my game right now so thought I'd just check the forums to see if anyone has built such a function already to save myself time as soon I'll have use for such a function. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted March 8, 2012 Share Posted March 8, 2012 At a constant rate, ignoring everything? I couldn't imagine it would be very hard but can't blame you for asking (nor would this be the first time I underestimated the difficulty of something, ha ha). x1 += (x2 - x1) / stepsremaining; y1 += (y2 - y1) / stepsremaining; z1 += (z2 - z1) / stepsremaining; Something like that? Quote Link to comment Share on other sites More sharing options...
Rick Posted March 8, 2012 Author Share Posted March 8, 2012 Yeah, I can interpolate with a given step value. Maybe I need to look into the Curve function to get that slowdown when nearing the destination. Again, wasn't really asking because I couldn't figure it out (I've posted interpolation code on the forums here before somewhere), just thought someone had built a nice and neat MoveEntityTo() function already that I could just blop into my code when I was ready for it. A post asking if someone had something takes about 15 seconds to write up. Writing, testing, and tweaking the code to get the feel of PointEntity takes longer so if someone already did it and was willing to share could save me time as it wasn't a need for right now. Will get to that part in my code next week. Thanks for a reply Quote 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.