Gabriel Posted February 22, 2012 Share Posted February 22, 2012 Hello, Who could tell me how to move the camera from point "A" to point "B" and look in direction of point "C" ? I fail to understand the pivot, probably my english is very very poor;-) Many thanks Gabriel Quote Link to comment Share on other sites More sharing options...
gamecreator Posted February 22, 2012 Share Posted February 22, 2012 I believe you could do these with Entity commands. First, point A toward B with PointEntity. Then, use MoveEntity to move A toward B. Finally, point A toward C with PointEntity again. I haven't tried this myself but this would be my first thought. Quote Link to comment Share on other sites More sharing options...
Gabriel Posted February 22, 2012 Author Share Posted February 22, 2012 Oups sorry, I want to move the camera from point "A" to point "B" to point "C" and look at direction "(target)" Thank see picture ;-) Quote Link to comment Share on other sites More sharing options...
Gabriel Posted February 27, 2012 Author Share Posted February 27, 2012 No good idea for me ? Quote Link to comment Share on other sites More sharing options...
Canardia Posted February 27, 2012 Share Posted February 27, 2012 Parent the camera to a pivot and move the pivot, but rotate the camera. Use PointEntity on the pivot to align it to the target waypoint, and use PointEntity on the camera, to point to the look at target. 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...
Naughty Alien Posted February 27, 2012 Share Posted February 27, 2012 Let say these are your game components. MyPivot:TPivot=CreatePivot() MyCamera:TCamera=CreateCamera() ' Or any camera you use MyTarget:TMesh=CreateCube() MyPivot is used for moving trough space, MyCamera is, well camera , and MyTarget is entity you want your camera to look at. So, in that case, you will do next in your main loop 'Move trough space If KeyDown(KEY_W) MoveEntity(MyPivot, Vec3(0,0,1)) If KeyDown(KEY_S) MoveEntity(MyPivot, Vec3(0,0,-1)) If KeyDown(KEY_A) MoveEntity(MyPivot, Vec3(-1,0,0)) If KeyDown(KEY_D) MoveEntity(MyPivot, Vec3(1,0,0)) 'Now align camera to corresponding position PositionEntity(MyCamera,EntityPosition(MyPivot),1) 'And Finally lets turn camera to requested target PointEntity(MyCamera,MyTarget) ..and you are good to go..there are more advanced techniques to do this, but this is good enough to get you up and running..and one small tip...ALWAYS avoid parenting...ALWAYS..I hope it helps.. Quote Link to comment Share on other sites More sharing options...
Clackdor Posted February 27, 2012 Share Posted February 27, 2012 ..and one small tip...ALWAYS avoid parenting...ALWAYS..I hope it helps.. OK, this is the first time I've read this particular piece of advice on these boards. Why avoid parenting? Quote Link to comment Share on other sites More sharing options...
Roland Posted February 27, 2012 Share Posted February 27, 2012 OK, this is the first time I've read this particular piece of advice on these boards. Why avoid parenting? Yeah! I would also like some elaboration on that. What's the problem with parenting. Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Naughty Alien Posted February 27, 2012 Share Posted February 27, 2012 ..when your structure grows, and your classes are nested inside each other, parented entities you using/accessing in different classes are a nightmare to deal with considering all transformations applied to child if parent is modified on any way..this easy came in to picture with animation, particularly cut scene animations where same character/camera acting as a gamplay driven as well as cut scene character/camera...if your 3rd perspective camera is attached to that particular character and at same time involved in to cut scene, where camera/characters are utilized by external keyframing data,you will have entire set of variables as an offset from original state where whole process started..just one of the examples...if you using custom made math lib for specific purpose, things getting even worse.. Quote Link to comment Share on other sites More sharing options...
Roland Posted February 27, 2012 Share Posted February 27, 2012 Thank's for the info Naughty Alien Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Pixel Perfect Posted February 27, 2012 Share Posted February 27, 2012 I avoid parenting too, especially with character controllers and models. Have run into all sorts of weird issues in the past when I was developing my path finding. I always now just manually up date the models position/rotation etc based on the character controllers for a trouble free life! Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Clackdor Posted February 27, 2012 Share Posted February 27, 2012 Good perspective. I'll keep it in mind. Quote Link to comment Share on other sites More sharing options...
Aily Posted February 28, 2012 Share Posted February 28, 2012 Oups sorry, I want to move the camera from point "A" to point "B" to point "C" and look at direction "(target)" Thank see picture ;-) First of all you need to write script for camera movement smooth path. Here's good example, but in actionscript. http://actionsnippet.com/?p=1031 In result you must get path object that will be store all points on path, and one function to return smooth coordinates along path, where path will be started at 0 and finish on 1 And while camera will moves along this path, point it to target. Like (in lua) ...... path=create_path() path.add_point(x,y,z) path.add_point(x,y,z) path.add_point(x,y,z) path.add_point(x,y,z) path.add_point(x,y,z) path.build() t=0 while KeyHit(KEY_ESCAPE)~=1 or t<1 do t=t+.01 xyz=path.get_coords(t) PositionEntity(camera,xyz) PointEntity(camera,target) RenderWorld() Flip(1) end Quote "Better" is big enemy of "good" Link to comment Share on other sites More sharing options...
Gabriel Posted February 28, 2012 Author Share Posted February 28, 2012 @all thank for all ;-) Gabriel 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.