Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,135 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 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