Ask Your Question
0

Conversion Position to float

asked 2014-08-12 06:01:05 -0500

Moda gravatar image

updated 2014-08-12 06:49:04 -0500

I got in a variable Position (which I get from transform.getOrigin) and I want to convert it in a pair of float. How can I do that? I'm in Hydro, Ubuntu 12.04 and programming in c++

edit retag flag offensive close merge delete

Comments

2

Should we guess which programm language you use? I will never understand why people ask questions with that minimal amount of information.

BennyRe gravatar image BennyRe  ( 2014-08-12 06:15:09 -0500 )edit

How is this supposed to work? The origin has 3 degrees of freedom and you want to somehow store them in 2 floats?

dornhege gravatar image dornhege  ( 2014-08-12 06:49:39 -0500 )edit

yes this is the case

Moda gravatar image Moda  ( 2014-08-12 06:50:55 -0500 )edit
1

use typecast float posf = (float) position;

bvbdort gravatar image bvbdort  ( 2014-08-12 06:56:47 -0500 )edit

It works, thank you!!!

Moda gravatar image Moda  ( 2014-08-12 07:22:55 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-08-12 07:23:29 -0500

Moda gravatar image

updated 2014-08-12 07:23:44 -0500

The Solution is float posf = (float) position; given by @bvbdort

edit flag offensive delete link more

Comments

2

You could also use the C++ way of casting: float posf = static_cast<float>(position);

BennyRe gravatar image BennyRe  ( 2014-08-12 07:43:06 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-08-12 06:01:05 -0500

Seen: 92 times

Last updated: Aug 12 '14