ParaToxic Posted December 30, 2011 Share Posted December 30, 2011 Hey, first a good new year I have a problem with my controll for a 3rd person game. I would like to rotate the camera ,which is directed with pointentity to the character,around the character with a radius of 3.5. But I need it to do with the position not with the rotation.But I don't know how to make that. I have only the angle in form of a float value and of curse the Character Mesh/Position... Here is my professional painted picture pic.bmp Thanks for help Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 30, 2011 Share Posted December 30, 2011 assuming this is what you are talking about, look at the driver.lua example that comes with the SDK. create a terrain inside the editor then run the driver.lua script with the Editor's inherent ScriptEditor... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted December 30, 2011 Share Posted December 30, 2011 So are you trying to move the camera around your player using orbital positions rather than parenting to a pivot which is parented to your character? Im not sure if that's what you mean so let me know. If that is what you mean, particularly why do you need to do that? If you give me some context I may be able to help better. Regards, Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
ParaToxic Posted December 30, 2011 Author Share Posted December 30, 2011 I would like to position the camera around the Character with the angle value. So I have only the Angle ,no Pivots.The Camera have to turn around the Character with the angle value. EDIT: Better I tell you what I would do. I made a easy controll with the following commands: PositionEntity(MiddlePivot,Vec3(EntityPosition(Controller0).X,EntityPosition(Controller0).Y + 1.6,EntityPosition(Controller0).Z)); PointEntity(CameraPivot,MiddlePivot); MoveEntity(CameraPivot,Vec3(TFormPoint(Vec3(0,1,-3),MiddlePivot,CameraPivot).X/40.0,TFormPoint(Vec3(0,1,-3),MiddlePivot,CameraPivot).Y/40.0,TFormPoint(Vec3(0,1,-3),MiddlePivot,CameraPivot).Z/40.0)); The Problem is if I would turn the Camera , I have to turn the MiddlePivot ,but its a very smoothlie turning because. So I would like to add the rotation extern to CameraPivot (Camerapivot is actually the Camera self but it is in a protected class ,that i have to set the camera as a parent to the pivot). Quote Link to comment Share on other sites More sharing options...
Clackdor Posted December 30, 2011 Share Posted December 30, 2011 I did this with trigonometry. Parented the camera to the player controller. Parented a Pivot that was about shoulder high. See my video for how this looks. PositionEntity(camera,Vec3(0,1+mz*sin(atan(camrotation.X/40)),mz*cos(2*3.14-atan(camrotation.X/20)))); PointEntity(camera,pivot); Quote Link to comment Share on other sites More sharing options...
ParaToxic Posted December 30, 2011 Author Share Posted December 30, 2011 Thanks for the Code but I going to take my because it behaves differently. I think I going to ask something else. I have here the following code,but when the Pivot rotates to fast(you rotate it with the mouse) it "estimate" because of the smoothing.But I need this smoothing because I think it looks very good just this rotation problem is a problem. Maybe somebody can tell me how to fix that,maybe with a "extern" Positioncoordinates for the rotation. mx = MouseX() - GraphicsWidth()/2.0; my = MouseY() - GraphicsHeight()/2.0; PivotRotation.X += my; PivotRotation.Y -= mx; MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); RotateEntity(MiddlePivot,Vec3(PivotRotation.X,PivotRotation.Y/10.0,0)); PointEntity(CameraPivot,MiddlePivot); PivotRotation.X = Curve(max(PivotRotation.X,-20.0),PivotRotation.X,2.0); PivotRotation.X = Curve(min(PivotRotation.X,23.0),PivotRotation.X,2.0); MoveEntity(CameraPivot,Vec3(TFormPoint(Vec3(0,1,-3),MiddlePivot,CameraPivot).X/40.0,TFormPoint(Vec3(0,1,-3),MiddlePivot,CameraPivot).Y/40.0,TFormPoint(Vec3(0,1,-3),MiddlePivot,CameraPivot).Z/40.0)); PositionEntity(MiddlePivot,Vec3(EntityPosition(Controller0).X,EntityPosition(Controller0).Y + 1.6,EntityPosition(Controller0).Z)); Quote Link to comment Share on other sites More sharing options...
Clackdor Posted December 30, 2011 Share Posted December 30, 2011 mx=Curve(MouseX()-GraphicsWidth()/2,mx,6); my=Curve(MouseY()-GraphicsHeight()/2,my,6); PivotRotation.X += my/15; PivotRotation.Y -= mx/15; I do the curve when calculating the mx and my values. I, also, add the /15 modifier to make it not rotate as fast with the mouse in that same piece of code in my project. Of course, it could be made into a modifiable value based on user preference. Quote Link to comment Share on other sites More sharing options...
ParaToxic Posted December 30, 2011 Author Share Posted December 30, 2011 Yes but it isn't realy a Solution because it turns slower ,but if the user put the mouse intensitiv higher the rotation collaps again. Quote Link to comment Share on other sites More sharing options...
Clackdor Posted December 30, 2011 Share Posted December 30, 2011 I guess I'm not sure I understand the question then. Sorry. Quote Link to comment Share on other sites More sharing options...
ParaToxic Posted December 31, 2011 Author Share Posted December 31, 2011 By the way the problem is solved but I think I try to explane it again. When you write PivotRotation += mx/15.0; the Camera rotate to slow or a user will make it more intensive and put the value for exaple to PivotRotation += mx/5.0. So I have the same problem as before,because if the pivot rotate ,the camera doesn't follow directly ,and when you rotate it to fast for example the pivot angle is 350° and the Cameraangle still 70° ,the camera will turn back ,because its faster to turn the other way. 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.