playMaker

Author Topic: Normalize Vector3 to Camera  (Read 1633 times)

eggmanwalrus@hotmail.co.uk

  • Playmaker Newbie
  • *
  • Posts: 2
Normalize Vector3 to Camera
« on: April 02, 2014, 08:02:53 PM »
Hi,

Newbie here. I'm using a 'mouse pick' action to get a Vector3 from the camera. Mouse pick only works if there is an object to raycast to so I use a background plane. My problem is that when I pull out the X and Y from the vector Iget some weird numbers including negative numbers.

Is there a way to return X and Y from where the mouse cursor is that gives values between 0,0 (bottom left of the screen) and 1,1 (top right of the screen) irrespective of resolution and linked strictly to the camera (the game world is bigger than the viewport.

Any help would be appreciated.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Normalize Vector3 to Camera
« Reply #1 on: April 02, 2014, 08:08:13 PM »
Welcome =)

You should be able to use this for what you're doing. GUI space is not a fun place, try using Invert Y and Normalize to give you screen positions.

http://hutonggames.com/playmakerforum/index.php?topic=5862.msg28330#msg28330
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D