Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted

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.

Posted

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.

Posted

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?

Posted

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.

Posted

Recoil has already been done multiple times, there are multiple resources on different styles of recoil systems:


http://www.garagegames.com/community/resources/view/21867

http://www.garagegames.com/community/resources/view/10243

http://www.garagegames.com/community/resources/view/21868

http://www.garagegames.com/community/resources/view/10241


Test these out and see if it does what you need and then tell me which is best, since I also need a recoil system.

Posted

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.

Posted

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.

Posted

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?

  • 2 weeks later...
Posted

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.

Posted

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?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...