[ERRO] RotateTo

Started by MatheuS, Dec 14, 2014, 03:13 PM

Previous topic - Next topic

MatheuS

if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

Thijn

Ah, of course. Try running my tool again.

MatheuS

continuous with the same error. :o
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

Thijn

This should work: CreateObject(310, 1, 391.686, -486.215, 11.3129, 255 ).RotateTo( Quaternion( 0, 0, -0.422618, 0.906308 ), 0 );

.

#4
How did you managed to get so many mistakes in just one line of code? :D



First: The RotateTo() member function expects a Quaternion and a time span in the format of seconds (an integer)



Second: Variable gateDP is an array, correct? Then WTF are you doing with gateDP = ... Where's your index [...] when you insert the created object instance? After that line gateDP will no longer be an array due to the assignment.



Third: Chaining and assignment in a single line? DA FUQ ARE YOU HOPING FOR? The RotateTo() member function returns nothing. And because of the chaining of operations you'll get null inside gateDP which will probably break the rest of the code as well.



Advice: Stop chaining operations that return null and perform assignment in the same expression.

EDIT: Another post was made while I was writing this one :D Answers your question but the code is still broken.
.

MatheuS

Quote from: Thijn on Dec 14, 2014, 04:22 PMThis should work: CreateObject(310, 1, 391.686, -486.215, 11.3129, 255 ).RotateTo( Quaternion( 0, 0, -0.422618, 0.906308 ), 0 );

Work.
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

Thijn

@S.L.C. the piece of code after the = comes from my IPL converter. While it's true it isn't nice to chain those commands together, it should work fine for adding lots of objects without worrying about assigning them to variables. Yes, I could've used a lot of IF statements, but I didn't for the sake of simplicity.

.

Quote from: Thijn on Dec 14, 2014, 06:15 PM@S.L.C. the piece of code after the = comes from my IPL converter. While it's true it isn't nice to chain those commands together, it should work fine for adding lots of objects without worrying about assigning them to variables. Yes, I could've used a lot of IF statements, but I didn't for the sake of simplicity.

Agreed. But I was referring to the fact that he performs an assignment with that and worse he performs the assignment on an array without specifying an index.
.

MatheuS

not show me more error, the rotation is wrong :-[
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

Sebastian

I believe there is some mistake in the source code of function... like "y,w,z,x" instead of "x,y,z,w".
I also tried to manually convert xml object to CreateObject, and the rotation is also wrong.

aXXo

Quote from: aXXo on Jan 10, 2015, 04:50 AMNot sure if this is already known, but I'll post anyway since I experienced the same problem.

Apparently the negative rotation values from KEd are comprehended incorrectly by VCMP.
If you remove the negative sign, you will get the expected result.

There you go:
CreateObject( 1395, 0, Vector(396.41, -472.947, 13.5824), 255).RotateTo( Quaternion(0, 0, 0.422618, 0.906308), 0 );

Sebastian

#11
Really useful found ! I will surely give it a try, and return with an edit. ;)

EDIT: Yeah, it works. :D
I changed the negative values with positives, and positives with negatives.

Thank you alot !

MatheuS

Quote from: sseebbyy on Jan 10, 2015, 11:09 PMReally useful found ! I will surely give it a try, and return with an edit. ;)

EDIT: Yeah, it works. :D
I changed the negative values with positives, and positives with negatives.

Thank you alot !

Remembering, we must remove the negative value of the Quaternion only.

Thanks to all who responded!
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.