DudeAwesome Posted February 14, 2014 Share Posted February 14, 2014 -- MOVEMENT local move = ((App.window:KeyDown(Key.W) and 1 or 0) - (App.window:KeyDown(Key.S) and 1 or 0))*4 local strafe = ((App.window:KeyDown(Key.D)and 1 or 0) - (App.window:KeyDown(Key.A) and 1 or 0))*4 self.entity:SetInput(0,move,strafe) -- CAMERA --self.camera:SetInput(0,move,strafe) //will not work i used the code from the docu to create a basic movement script using WASD. SetInput() is available for every Entity that is using the CharacterController. My Problem is that my Camera should move like the character but SetInput will not work for my camera. Any clue how to do this? Using self.camera:Translate() and self.camera.Move() will work but its hard to calculate camera speed from character movement, so my camera is to fast and it will run out. its easier to use my outcommented code line. If I use Character Controller for my camera the game is going crazy. I use 3rd person view Quote It doesn´t work... why? mhmmm It works... why? Link to comment Share on other sites More sharing options...
Rick Posted February 14, 2014 Share Posted February 14, 2014 Use the normal entity character controller and set the camera's position (x/z anyway) to the controllers after you call SetInput(). Then take the controllers y position and add an offset because otherwise it'll be at ground level which is probably what you don't want. This is basically what a FPS game does. The player moves around a controller and the camera just gets set to the controllers position with a y offset. 1 Quote Link to comment Share on other sites More sharing options...
DudeAwesome Posted February 15, 2014 Author Share Posted February 15, 2014 mhmmm no way to setInput just to a camera? Im using 3rdPersonView Quote It doesn´t work... why? mhmmm It works... why? Link to comment Share on other sites More sharing options...
Rick Posted February 15, 2014 Share Posted February 15, 2014 Video says it's private. I don't think you can. In 3rd person you are generally following something (character). So you still need a character controller. What you do then is set the position to the controllers position, and then use Move() on the camera to offset up back from the character. Then you rotate your camera to look down (or do a point at function to point at the character). Quote Link to comment Share on other sites More sharing options...
DudeAwesome Posted February 15, 2014 Author Share Posted February 15, 2014 mhmm ok I hoped there is a easy way but in this case I have to do it like this I guess. thx rick. here is the video should be public now: http://youtu.be/kybGY9Vcy5g Quote It doesn´t work... why? mhmmm It works... why? Link to comment Share on other sites More sharing options...
Rick Posted February 15, 2014 Share Posted February 15, 2014 It is actually very easy. self.entity:SetInput(blah, blah, blah); self.camera:SetPosition(self.entity:GetPosition()) self.camera:SetRotation(Vec3(45, 0, 0)) self.camera:Move(Vec3(0, 3, 2)) Just play around with the Move() values to get the distance right, and the rotation value to get it pointing at the character right. If you want to add rotation around with the mouse it gets a little more involved. 1 Quote Link to comment Share on other sites More sharing options...
DudeAwesome Posted February 15, 2014 Author Share Posted February 15, 2014 thanks works fine;) Quote It doesn´t work... why? mhmmm It works... why? 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.