Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (flink, AndrewAMD), 656 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
bonerotate to face camera - only working at certain angles #445234
08/31/14 22:47
08/31/14 22:47
Joined: Mar 2003
Posts: 1,524
Canada
Stansmedia Offline OP
Serious User
Stansmedia  Offline OP
Serious User

Joined: Mar 2003
Posts: 1,524
Canada
Anybody know how to fix this problem? The head faces the camera at certain angles, but then it hits a point and it stops working. I've been searching the forum for a little while trying to find a solution but have not had any luck.

Code:
ent_bonereset(my,"head");
vec_for_bone(bone_pos.x,my,"head");
vec_set(temp_vec,camera.x);
vec_sub(temp_vec,bone_pos.x);
vec_to_angle(temp_angle,temp_vec);
vec_sub(temp_angle, my.pan);
bone_angle.pan = temp_angle.pan;
bone_angle.tilt = temp_angle.tilt;
bone_angle.roll = 0;
bone_angle.tilt = clamp(bone_angle.tilt, -90, 90);
bone_angle.pan = clamp(bone_angle.pan, -90, 90);
ent_bonerotate(my,"head",bone_angle);



Decessus - 80% done. 100% abandoned.
GET MY ANDROID GAME! https://play.google.com/store/apps/details?id=com.lasertrain.zspinballfree&hl=en
Re: bonerotate to face camera - only working at certain angles [Re: Stansmedia] #445237
09/01/14 08:40
09/01/14 08:40
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi,
try using the -180<->180 range on angles substraction result. I did not test it.

Code:
bone_angle.pan = clamp(ang(temp_angle.pan), -90, 90);
bone_angle.tilt = clamp(ang(temp_angle.tilt), -90, 90);
bone_angle.roll = 0;



I hope it helps.
Salud!

Re: bonerotate to face camera - only working at certain angles [Re: txesmi] #445255
09/01/14 17:49
09/01/14 17:49
Joined: Mar 2003
Posts: 1,524
Canada
Stansmedia Offline OP
Serious User
Stansmedia  Offline OP
Serious User

Joined: Mar 2003
Posts: 1,524
Canada
Looks like it did the trick! Good ol' ang(...) to the rescue. lol


Decessus - 80% done. 100% abandoned.
GET MY ANDROID GAME! https://play.google.com/store/apps/details?id=com.lasertrain.zspinballfree&hl=en

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1