playMaker

Author Topic: How to clamp ship?  (Read 2065 times)

ptrlo

  • Playmaker Newbie
  • *
  • Posts: 31
How to clamp ship?
« on: October 30, 2014, 08:23:18 AM »
In a top down space ship game I need to clamp it so it doesn't go off screen, how do I achieve this? I store the ships X and clamp it, but it does nothing.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: How to clamp ship?
« Reply #1 on: October 30, 2014, 08:53:42 AM »
Add colliders where you don't want to allow it to go.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

ptrlo

  • Playmaker Newbie
  • *
  • Posts: 31
Re: How to clamp ship?
« Reply #2 on: October 30, 2014, 09:33:02 AM »
I tried that method as well, but for some reason my ship will not collide. I'ts a custom mesh, and the walls are basic cubes. They all have rigidbodies, etc.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: How to clamp ship?
« Reply #3 on: October 30, 2014, 10:34:10 AM »
Did you add colliders on both your ship and the walls? Are you moving it with Translate?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

ptrlo

  • Playmaker Newbie
  • *
  • Posts: 31
Re: How to clamp ship?
« Reply #4 on: October 31, 2014, 03:19:28 AM »
Checked colliders and countless other things.

Yes, I am moving it with translate.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: How to clamp ship?
« Reply #5 on: October 31, 2014, 10:35:46 AM »
You need to move it with forces, translate is changing the position and ignoring physics.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D