Jump to content

Move Entity To


Rick
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...