playMaker

Author Topic: Swimming [Solved]  (Read 4248 times)

greg

  • Junior Playmaker
  • **
  • Posts: 68
Swimming [Solved]
« on: March 25, 2013, 05:15:53 PM »
I have a FPS player who moves via: "get axis" and "controller move"

Whilst swimming i want forward movement in the cameras direction, using controller move on the player.

Ideas? Seems kinda tricky.

[EDIT] solution at end of topic :)
« Last Edit: March 26, 2013, 01:48:44 PM by greg »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: swimming
« Reply #1 on: March 26, 2013, 01:55:41 AM »
Hi,

 I am not sure I follow why you want to move relative to the camera? the camery should follow the user instead, even when swimming I guess.

 to apply "sinking", you don't need to edit the gravity, instead simply apply a down force, that will be more predictable, so that the user always have to swim "up" if you see what I mean. and with this, you can lower the down force if the user moves forward fast enough, in that way, you will need to change the downforce based on the player speed.

bye,

 Jean

greg

  • Junior Playmaker
  • **
  • Posts: 68
Re: swimming
« Reply #2 on: March 26, 2013, 11:01:33 AM »
I am not sure I follow why you want to move relative to the camera?
 to apply "sinking", you don't need to edit the gravity, instead simply apply a down force

Hi Jean. I still want the camera to follow the player. Moving relative to camera direction would mean that holding forward = you swim where you are facing (Z-direction of camera), so you could swim up/down smoothly.. this is how it works in any FPS game like Half Life/Unreal.

I have the "VerticalSpeed" of the player grabbed at all times, so interpolating that to a "sink value" of say.. -2, would mean that if you jumped into water from a high ledge, you'd have the feeling of water resisting your fall as you sink, and if you dropped into it from a ledge level to the water, the water resistance would feel less severe and smoother.. imitating real water resistance physics.

greg

  • Junior Playmaker
  • **
  • Posts: 68
Re: Swimming (forward movement in camera direction)
« Reply #3 on: March 26, 2013, 01:48:14 PM »
SOLVED
Image attached for solidarity. Found a solution after a millenia searching the dry wasteland of Unity Answers.

Cant say i 100% understand this, so could anyone more learn-ed offer an explanation, akin to one you would offer a child..

(it converts movementDirection to world space, relative to the cameras direction?)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Swimming [Solved]
« Reply #4 on: March 27, 2013, 07:36:47 AM »
Hi,

 Nice one.

bye,

 Jean