1 registered members (tomaslolo),
1,542
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: joy force
[Re: Funeral]
#384120
09/29/11 14:17
09/29/11 14:17
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
Ah now I see my fault, sorry for this. The -= 90 offset should only be executed if the angle was updated, this I did not consider. I'd suggest this code:
VECTOR forceVec; // our vector we will set depending on joy_force and use for rotation - global definition or local but not in a loop!
var forceThreshold = 0.1; // our threshold value, adjust this if needed
...
// in the function:
vec_set(forceVec, nullvector); // reset our forceVec
if(abs(joy_force.x) > forceThreshold)
{
forceVec.x = sign(joy_force.x);
}
if(abs(joy_force.y) > forceThreshold)
{
forceVec.y = sign(joy_force.y);
}
if(vec_length(joy_force) > 0) // any change?
{
vec_to_angle(my.pan, forceVec);
my.pan -= 90; // remove this line if no offset needed
}
|
|
|
Re: camera dependent movement
[Re: Funeral]
#384176
09/30/11 08:19
09/30/11 08:19
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
So you want the move directions of the character to be dependent on the angle of the camera?
When the player moves the character forward and while moving changes the camera angle, should the character automatically adapt to this change (means rotate too) or should he keep moving the direction he had before rotating the camera?
Last edited by Xarthor; 09/30/11 08:19.
|
|
|
|