UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Vectors and MoveTo

broken avatar :(
Created 10 years ago
by MegaMech43
0 Members and 1 Guest are viewing this topic.
2,703 views
broken avatar :(
×
broken avatar :(
Location: caCanada, Eh
Date Registered: 24 November 2016
Last active: 8 years ago
Posts
85
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
MegaMech43's Groups
MegaMech43's Contact & Social Linksmegamechmegamech.net
Does this code look correct to make a brushmodel move.


Code Snippet
Plaintext
doorL = GetEnt(blahblahblah);
vectorarray = [];
vectorarray[1] = 80; vectorarray[2] = 0; vectorarray[3] = 80;
  vector = VectorScale( vectorarray , 1 );

doorL MoveTo( doorL.origin + vector, 10, 10 * 0.25, 10 * 0.25 );
Marked as best answer by MegaMech43 9 years ago
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 2 years ago
Posts
1,186
Respect
1,332Add +1
Forum Rank
Zombie Colossus
Primary Group
Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntStuffyBluntstuffy@BluntZombieStuffyZombie
Seems a bit overcomplicated, but first of all let me note that i'm not too familiar yet with bo3 code. I'm still stuck in WaW finishing my project, still i'm pretty sure this will apply to both. But do keep in mind the actuall code might be a bit different!!


An array index starts at 0, so if you want to define a vector like that, do:

Code Snippet
Plaintext
vectorarray[0] = 80;
vectorarray[1] = 0;
vectorarray[2] = 80;

but tbh, why not just do:

Code Snippet
Plaintext
doorL.origin + ( 80,0,80)


Also i dont think you are using the vectorscale() right, this is a bit of code from WaW that would move 50 units to the right from the start_pos:

Code Snippet
Plaintext
	angles = self getPlayerAngles();
angles_right = AnglesToRight( angles );

start_pos = self.origin;
new_pos = start_pos + vectorScale( angles_right, 50 );



-But why not even do it easier, and put a script_struct on the origin where the brush needs to move to.
-Make the brush target the struct with the 'targetname' and 'target' KVP's
-in the script do ( remember WaW code, so it might be slightly different! )

Code Snippet
Plaintext
doorL = GetEnt(blahblahblah);
door_target = GetStruct( doorL.target, "targetname" );

doorL MoveTo( door_target.origin, 10, 2.5, 2.5 );

Last Edit: November 25, 2016, 08:57:21 pm by BluntStuffy
broken avatar :(
×
broken avatar :(
Location: caCanada, Eh
Date Registered: 24 November 2016
Last active: 8 years ago
Posts
85
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
MegaMech43's Groups
MegaMech43's Contact & Social Linksmegamechmegamech.net
Ah hahaha. Can't believe I put [1] instead of
  • . Such a nooby mistake.

First of all I think the last two parameters of MoveTo needs to be under "1" ex "0.5" in order to work.

Now here's my next problem and a huge frustration at radiant tools.
Let's take the Z value (Which should actually be Y, up and down).
In radiant tools it takes the top of the model. Whether the center or a corner I don't know.
For the method MoveTo it takes the very center of the model.
So when I position the model in radiant tools, and copy the coordinates, I get a very different output in-game.
Any way around this? Is it possible to move the manipulation handles to the edge?
It would be nice if the game told you the size of your object.

This code works.
Code Snippet
Plaintext
doorL = GetEnt("craft_door_a", "targetname");
door_target = GetEnt( "craft_door_a_target",
doorL MoveTo( (-1213.4,723.6,265), 3, 0.3, 0.3 );

 
Loading ...