playMaker

Author Topic: Problem Storing Negative Scale X Value  (Read 557 times)

meghapants

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Problem Storing Negative Scale X Value
« on: June 23, 2016, 10:31:48 AM »
Hey everyone,

I've been working with a great 2D platformer motor I found on github, but I'm trying to integrate a few of my own player actions with Playmaker. My player character is a 3D object for aesthetics only, but is being treated like a 2D object (2D collider, 2D rigidbody, 2D motor, etc).

The way the motor works is when the positive horizontal input (in this case D) is pressed the character moves to the right and has a scale of (1,1,1). When negative horizontal input (A) is pressed the character moves to the left and has a scale of (-1,1,1) which flips the object in the opposite direction.

I'm setting up the character's ability to throw objects, and those objects are having force added to them on creation. I'm using the Get Scale action to find the scale X value of the character, and storing it in a global float. The problem I'm having is that the global will never store the negative value, only the positive, so my check always comes back as applying the force in a positive direction.

Is it possible to store negative values into floats? Maybe I need to use a different action? Thanks in advance.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4188
    • View Profile
    • jinxtergames
Re: Problem Storing Negative Scale X Value
« Reply #1 on: June 23, 2016, 12:13:27 PM »
Hi,
Yes floats and int's can store negative values.

I have tested the get scale action and it seems to work fine, so the problem may lay somewhere else.