Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: MatheuS on Dec 14, 2014, 03:13 PM

Title: [ERRO] RotateTo
Post by: MatheuS on Dec 14, 2014, 03:13 PM
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FvMJbk6x.png&hash=6e5959eab951c7438ccda9ac465cf381f60e3a95)
Title: Re: [ERRO] RotateTo
Post by: Thijn on Dec 14, 2014, 03:22 PM
Ah, of course. Try running my tool again.
Title: Re: [ERRO] RotateTo
Post by: MatheuS on Dec 14, 2014, 03:45 PM
continuous with the same error. :o
Title: Re: [ERRO] RotateTo
Post by: Thijn on Dec 14, 2014, 04:22 PM
This should work: CreateObject(310, 1, 391.686, -486.215, 11.3129, 255 ).RotateTo( Quaternion( 0, 0, -0.422618, 0.906308 ), 0 );
Title: Re: [ERRO] RotateTo
Post by: . on Dec 14, 2014, 04:24 PM
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.
Title: Re: [ERRO] RotateTo
Post by: MatheuS on Dec 14, 2014, 04:44 PM
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.
Title: Re: [ERRO] RotateTo
Post by: 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.
Title: Re: [ERRO] RotateTo
Post by: . on Dec 14, 2014, 06:19 PM
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.
Title: Re: [ERRO] RotateTo
Post by: MatheuS on Dec 21, 2014, 01:57 AM
not show me more error, the rotation is wrong :-[
Title: Re: [ERRO] RotateTo
Post by: Sebastian on Dec 21, 2014, 03:03 PM
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.
Title: Re: [ERRO] RotateTo
Post by: aXXo on Jan 10, 2015, 04:50 AM
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 );
Title: Re: [ERRO] RotateTo
Post by: Sebastian on Jan 10, 2015, 11:09 PM
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 !
Title: Re: [ERRO] RotateTo
Post by: MatheuS on Jan 10, 2015, 11:43 PM
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!