|
|
Re: Panel to face the mouse cursor
[Re: Wafff]
#257417
03/23/09 10:22
03/23/09 10:22
|
Joined: Jul 2008
Posts: 894
TechMuc
User
|
User
Joined: Jul 2008
Posts: 894
|
it's not possible to rotate panels. use view entities instead
Last edited by TechMuc; 03/23/09 10:22.
|
|
|
Re: Panel to face the mouse cursor
[Re: Wafff]
#257461
03/23/09 12:59
03/23/09 12:59
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
close but no cigar, try this instead. VECTOR temp;
gun_pan.center_x = gun_pan.size_x * 0.5;
gun_pan.center_y = gun_pan.size_y * 0.5;
while(1)
{
vec_set(temp, gun_pan.pos_x);
vec_add(temp, gun_pan.center_x);
vec_sub(temp, mouse_cursor.x);
vec_to_angle(temp,temp);
gun_pan.angle = 90-temp.x;
wait(1);
}
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Panel to face the mouse cursor
[Re: Wafff]
#257464
03/23/09 13:05
03/23/09 13:05
|
Joined: Jul 2008
Posts: 894
TechMuc
User
|
User
Joined: Jul 2008
Posts: 894
|
oO Sorry man, didn't new anything of panel.angle... i could have sworn, that i havn't missed any new feature the last 2 years..
Last edited by TechMuc; 03/23/09 13:06.
|
|
|
Re: Panel to face the mouse cursor
[Re: Wafff]
#257620
03/24/09 11:51
03/24/09 11:51
|
Joined: Mar 2009
Posts: 112 Germany
KDuke
Member
|
Member
Joined: Mar 2009
Posts: 112
Germany
|
You can move the panel in the right direction by simply doing the following:
VECTOR temp;
VECTOR paneldirection;
gun_pan.center_x = gun_pan.size_x * 0.5;
gun_pan.center_y = gun_pan.size_y * 0.5;
while(1)
{
vec_set(temp, gun_pan.pos_x);
vec_add(temp, gun_pan.center_x);
vec_sub(temp, mouse_cursor.x);
//Here is the code I added into EvilSOB's
vec_normalize(temp, 1);
vec_set(paneldirection, temp);
//
vec_to_angle(temp,temp);
gun_pan.angle = 90-temp.x;
wait(1);
}
function moveMyPanel()
{
while(isMoving)
{
panelToMove.pos_x += speedOfMovement*paneldirection.x*time_step;
panelToMove.pos_y += speedOfMovement*paneldirection.y*time_step;
wait(1);
}
}
Last edited by KDuke; 03/24/09 11:55.
Using A7 Free Click and join the 3dgs irc community! Room: #3dgs
|
|
|
|