Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (kzhao, AndrewAMD, bigsmack, 7th_zorro), 869 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
smooth() #458832
04/01/16 17:02
04/01/16 17:02
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Hi,

With the code below I try to smoothly let player weapon follow the player camera though smooth() in a first person game. But it sometimes looks a bit laggy when I rotate the camera on e.g. 40 fps as if the fps is ~20 fps. If I remove the code lines with the smooth() function the small (but still noticeable) lag is gone.

Code:
vec_set (playerWeapon.x, vector (10, 0, -7)); 
vec_rotate (playerWeapon.x, camera.pan); 
vec_add (playerWeapon.x, camera.x); 
playerWeapon.z -= 1;
vec_set(playerWeapon.pan, camera.pan); 
smooth(playerWeapon.pan,0.75);
smooth(playerWeapon.tilt,0.75);
smooth(playerWeapon.roll,0.75);



Anyway to solve this? tia

Re: smooth() [Re: Reconnoiter] #458834
04/01/16 18:46
04/01/16 18:46
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Never mind, this works better:

playerWeapon.pan += clamp(ang(camera.pan - playerWeapon.pan) * 0.5, -20, 20) * time_step;


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