playMaker

Author Topic: Linking floats.  (Read 2041 times)

MajorIdea

  • Full Member
  • ***
  • Posts: 131
Linking floats.
« on: June 18, 2013, 07:25:07 AM »
Sounds like a name for a band, but it might be a silly question, as I'm very new to programming.

But is it possible to link float variables under certain ranges?

For example:

-I have the first float for the character speed that goes from 1 to 100;
-And the second that corresponds to the camera FOV and I want it between 70 and 100.

Is it possible to use playmaker in a way as to determine that as the character speed moves between 1-100 so too will the FOV move between 70-100.

So if the player is going at a speed of 50, the FOV will be set in real time to 85.

This is so insanely useful that the answer is probably right under my nose, but after going back and forth in the logics and maths I cant seem to find it.

Anyone?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Linking floats.
« Reply #1 on: June 19, 2013, 01:48:18 AM »
Hi,

 Use a an animation curve for this, and you can map values to another.

in your curve your start point is 1,70 and your end point is 100,100 and then for a given x ( speed) you know the related fov ( the y axis)

Does that make sense?

You can also sort this manually ( if it's linear):

1: compute your speed as a percentage
2: apply your fov adding 70 to 30*speed percent

yes?

bye,

 JEan