playMaker

Author Topic: Smoothing mouse input  (Read 2778 times)

FelixofMars

  • Playmaker Newbie
  • *
  • Posts: 6
Smoothing mouse input
« on: July 24, 2012, 04:53:09 PM »
Hi, I am creating a side scrolling 2.5D game and just got PlayMaker because it seemed like a sensible route.  So far I have used get position to get the cursor position then used set position to create a particle effect to represent my cursor.

That works fine, its moving as expected.

Next I created a character that follows the cursors X position and the distance you are away from the character increases the speed at which you move. I am using Vector3 to grab a lot of this positional stuff (as I assume I am meant to do) but I am seeing some fluctuation in the vectors and I want to round/smooth it out. Is there a clean way to remove the numbers after the decimal.

So say I have a number like 1.334 I would just like the value 1.3 or even 1.0

I assume its something very obvious but I cannot figure it out.

PlatinumPlayer

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Smoothing mouse input
« Reply #1 on: July 24, 2012, 08:11:39 PM »
I solved this issue by converting getting the x, y, and z of the vector three, save them as floats, convert those floats to ints (none decimal number and it can round for you), convert back to floats, and make a vector3 with them.

Also if its just jerky camera issues, have you tried itween functions?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Smoothing mouse input
« Reply #2 on: July 24, 2012, 11:09:22 PM »
I can't think of any immediate way to do that other than what Platinum suggested but that seems expensive for something so minor.

So far I've solved my issues like these by recreating the system using a different approach to the objective and trying new actions to build similar results. There's quite a lot to work with actually.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

FelixofMars

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Smoothing mouse input
« Reply #3 on: July 25, 2012, 04:12:55 PM »
Thanks, I will look at I-Tween but what you said seems to match exactly the suggestion I read from doing it via normal code methods. Strip out the X,Y,Z then convert them to ints.

Cheers.

I solved this issue by converting getting the x, y, and z of the vector three, save them as floats, convert those floats to ints (none decimal number and it can round for you), convert back to floats, and make a vector3 with them.

Also if its just jerky camera issues, have you tried itween functions?