Shard Posted January 21, 2010 Share Posted January 21, 2010 Hey guys, got another question. (Sorry about that btw, working on a tight deadline and having a few last minute troubles) I need to move an Entity smoothly between multiple TVec3's that I have and I'm not having any luck doing it right. Essentially it is a Way point navigation but the only problem that I'm having is getting a Entity to move between two points at a time. Currently I've had to resort to jumps between the locations but I would really like it to be smoothed out. Any code samples would be greatly appreciated. Current Code if(KeyHit(KEY_SPACE)) { wayPoints[current+1].Y = currentPos.Y; PositionEntity( enemyController, wayPoints[current+1]); } Quote Programmer/Engineer/Student www.reikumar.com 2.6 GHz Intel Core Duo - nVidia GeForce 8600 GT - Windows 7 64-bit - 4 Gigs RAM C++ - Visual Studio Express - Dark GDK - Leadwerks SDK Link to comment Share on other sites More sharing options...
Canardia Posted January 21, 2010 Share Posted January 21, 2010 Use PointEntity() and MoveEntity(). Your PositionEntity() just places it there, without moving it. You might need to use eventually physics commands though, unless the entity you are moving is not supposed to collide with anything. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Shard Posted January 21, 2010 Author Share Posted January 21, 2010 Use PointEntity() and MoveEntity(). Your PositionEntity() just places it there, without moving it. You might need to use eventually physics commands though, unless the entity you are moving is not supposed to collide with anything. I have already tried doing that but point entity takes an entity as a second parameter, which I don't have. I only have TVec3. Quote Programmer/Engineer/Student www.reikumar.com 2.6 GHz Intel Core Duo - nVidia GeForce 8600 GT - Windows 7 64-bit - 4 Gigs RAM C++ - Visual Studio Express - Dark GDK - Leadwerks SDK Link to comment Share on other sites More sharing options...
Canardia Posted January 21, 2010 Share Posted January 21, 2010 Then you need to create a Pivot and use PositionEntity() to place it to the Vec3 location. You can delete the pivot when a new waypoint is selected, or just keep them until the game ends. It would probably make more sense to use Pivots as waypoints instead of Vec3s, then you need also less coding and your program runs faster. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
TylerH Posted January 22, 2010 Share Posted January 22, 2010 The easiest way to do this is to use a Lerp function on the entity position and just call PositionEntity. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- 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.