playMaker

Author Topic: Slow Down Rigidbody  (Read 2624 times)

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Slow Down Rigidbody
« on: August 28, 2014, 05:55:03 PM »
Hey All, there is this demo here for a starfox clone. http://www.wflachess.org/starwolf/

I already have movement and such but I was wondering how to slow down the ship at the edge of the screen like in the demo. I know how to make it stop but it would be a hard stop as if hitting a wall. I like this slow down stop that is going on here. Any ideas would be appreciated!
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Slow Down Rigidbody
« Reply #1 on: August 30, 2014, 01:36:54 PM »
If you're using rigidbodies then you need to apply an opposing force to push it in, I think. I suppose trimming back the inputs would work as well. You could use the distance from the edge as a multiplier to either adjust inputs or a force from the outside.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: Slow Down Rigidbody
« Reply #2 on: August 30, 2014, 04:06:19 PM »
Interesting, How do I use an outside force to push it while making it seem like a barrier?
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Slow Down Rigidbody
« Reply #3 on: September 01, 2014, 11:19:43 PM »
Use a force that pushes from the outside direction. It would get stronger as the player gets closer to your specified boundary. It's probably more complicated than it sounds, but something along those lines might work, just a matter of giving it a try.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Phuzz

  • Full Member
  • ***
  • Posts: 101
    • Bzilla Games
Re: Slow Down Rigidbody
« Reply #4 on: September 02, 2014, 04:28:06 AM »
Lets say you have walls on the borders and you want maximum force to be 5, set the force (Strength = 5 - (Distance between Ship and Wall)) ofcorse using variables and operators also set at everyframe, probably this way the closer you get to the wall the stronger the force will be. [Based on Lanes' Solution]
Bzilla Games "Education with a Tickle!"
Qbucket Games "Voxel Games"

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: Slow Down Rigidbody
« Reply #5 on: September 02, 2014, 08:44:56 AM »
Right, so another game object that has an addforce in it with lets say 0 on x, x would increase based on distance to the wall which would make it slown down but... If I stop pushing against the wall, the wall would continue pushing the ship if its close. Unless I am misunderstanding this...
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

Phuzz

  • Full Member
  • ***
  • Posts: 101
    • Bzilla Games
Re: Slow Down Rigidbody
« Reply #6 on: September 02, 2014, 11:51:54 AM »
Maybe adding a Bool Value so the force would only work while key is pressed, basically,

Get Key Down, Store Result, then only if Bool is True  force will be activated, this way upon key release, "theoretically" Add Force should stop.
Bzilla Games "Education with a Tickle!"
Qbucket Games "Voxel Games"