Code_Man Posted July 3, 2018 Share Posted July 3, 2018 I hit a wall trying to get and set the angle of the view in height of the player.When i access the rotation value of %client.getCameraObject() it returns a value but it only gives me the values in the x axis(left/right).When i turn the view upward the normal vector does not change.I skimmed trough the docs and source code but to no avail. Quote Link to comment Share on other sites More sharing options...
Duion Posted July 3, 2018 Share Posted July 3, 2018 Maybe the camera does not rotate, but the player does. The camera is basically glued to the player and inherits the position and rotation of the bone that it is attached to, if it is attached to a bone. Quote Link to comment Share on other sites More sharing options...
Code_Man Posted July 3, 2018 Author Share Posted July 3, 2018 No, i already have the player rotation, which rotates only along the x axis, oddly enough the camera has the exact same angle, no trace of up/down movement. Quote Link to comment Share on other sites More sharing options...
Duion Posted July 3, 2018 Share Posted July 3, 2018 The player cannot rotate up/down as well, maybe it is giving you the player rotation instead. Quote Link to comment Share on other sites More sharing options...
Jason Campbell Posted July 4, 2018 Share Posted July 4, 2018 If it is only in first person couldn't you use the player eye rotation or transform? Quote Link to comment Share on other sites More sharing options...
Steve_Yorkshire Posted July 4, 2018 Share Posted July 4, 2018 For where something is pointing/aiming at, I think that you want the vector rather than the objects own rotation.Edit:Try %camera.getEulerRotation(); or %camera.getEyeVector(); Quote Link to comment Share on other sites More sharing options...
Code_Man Posted July 4, 2018 Author Share Posted July 4, 2018 For where something is pointing/aiming at, I think that you want the vector rather than the objects own rotation.Edit:Try %camera.getEulerRotation(); or %camera.getEyeVector();If that is correct then i have an even bigger problem.The thing is that i want to implement realistic weapons behaviour and that means i need to set the player height view value.If it is not encoded in camera.rotation and %camera.getEyeVector() does not have a corresponding set function, then how can i change where the player looks?I need not only the player view adjusted but the whole player model look up/down.That is according the the ShapeBase class reference. Quote Link to comment Share on other sites More sharing options...
Duion Posted July 4, 2018 Share Posted July 4, 2018 The weapon has its own vector, why you do not just use that, why you need the player camera view vector, what are you even trying to achieve? Quote Link to comment Share on other sites More sharing options...
Code_Man Posted July 4, 2018 Author Share Posted July 4, 2018 I want to simulate some kind of recoil setting off the player view forcing him to reaim at his target.Offsetting in the horizontal works fine, but not the vertical.Is weapon view the origin of camera?If it is not then offsetting the weapon will detatch the reticule from the weapon. Quote Link to comment Share on other sites More sharing options...
Duion Posted July 4, 2018 Share Posted July 4, 2018 Recoil has already been done multiple times, there are multiple resources on different styles of recoil systems:http://www.garagegames.com/community/resources/view/21867http://www.garagegames.com/community/resources/view/10243http://www.garagegames.com/community/resources/view/21868http://www.garagegames.com/community/resources/view/10241Test these out and see if it does what you need and then tell me which is best, since I also need a recoil system. Quote Link to comment Share on other sites More sharing options...
Code_Man Posted July 4, 2018 Author Share Posted July 4, 2018 I looked at all of those examples, they might work but in all honesty those are horrible hacks if you ask me.I will try them, but this doesnt inspire confidence in the api. Quote Link to comment Share on other sites More sharing options...
Duion Posted July 4, 2018 Share Posted July 4, 2018 I think they or some of the methods just offset the view by a random value up and sidewards, thats also how almost all other games do it I think.Counter Strike for example does not even have a random spray, but a hard coded spray pattern, so the recoil will be always exactly the same and if you memorize it good enough you can counteract it so you will always shoot accurate.I just ask what you want that is so revolutionary different than all other games that have recoil. Quote Link to comment Share on other sites More sharing options...
Code_Man Posted July 4, 2018 Author Share Posted July 4, 2018 Its just that im not sure setting a variable that changes player input or using an explosion to achieve this are such great ideas.And its sort confusing having a camera object entity separated from the player but not reflecting vertical states.Could someone explain the reason for this? Quote Link to comment Share on other sites More sharing options...
Code_Man Posted July 12, 2018 Author Share Posted July 12, 2018 Ok i used the method where the variable that gets input gets modified, it works ok so far, cant speak for multiplayer.But im still stunned at the idea what exactly happens.There must be some entity that controls where the player looks up/down serverside. Quote Link to comment Share on other sites More sharing options...
Code_Man Posted July 20, 2018 Author Share Posted July 20, 2018 I am facing a similar issue now but i cannot fall back on what i did previously.I am trying to make turnable vehicle turret, however once again i cannot set the camera rotation.%client.camera.setRotation(vectorAdd("x y z", %client.camera.getEulerRotation()) doesnt do squat, i tried with setMode("FreeRotate") too but no effect.However since i intend to make vehicles with turrets and barrels, i will probably add a shapeBase as a turret and shapeBaseImage as a barrel.If i can get the camera to be inside the turret i might solve my issue on atleast one axis, but now i wonder what would the control object have to be so i can delegate commands to both the turret/barrel and the vehicle itself. Anyone have an idea? 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.