[DP] Bumpy movement problem
Moderator: InsideQC Admins
7 posts
• Page 1 of 1
[DP] Bumpy movement problem
I'm new to QuakeC, so to teach myself the language, I decided to go for something simple first... like making a Doom 3-style cubemap flashlight (let's not get into the "flashlight sux" argument; the mod this is intended for will have nothing to do with Quake anyway).
But I notice that when the player moves up stairs, the flashlight bumps up and down really hard, like as if it's not keeping up with the player's movement.
Is there a way to interpolate the flashlight's position just like how the player's view is interpolated as he moves up and down?
My second problem is also related to the above; I notice corpses and gibs and stuff like that have very jerky movement when they are placed on lifts (it's easy to see if you kill the grunt in the first lift in E1M1). Is there any way to fix that, too?
Thanks.
But I notice that when the player moves up stairs, the flashlight bumps up and down really hard, like as if it's not keeping up with the player's movement.
Is there a way to interpolate the flashlight's position just like how the player's view is interpolated as he moves up and down?
- Code: Select all
// flashlight code
// player flashlight state
.float flashlight_state;
.entity flashlight;
void() flashlight_think =
{
if (self.owner.health > 0)
{
//setorigin(self, self.owner.origin + (self.owner.view_ofs - '0 0 16'));
makevectors (self.owner.v_angle);
traceline (self.owner.origin, (self.owner.origin + (v_forward * 32)), FALSE, self);
setorigin(self, trace_endpos + (v_forward * -16) + (self.owner.view_ofs - '0 0 8'));
self.angles = self.owner.v_angle;
self.angles_x = self.angles_x * -1;
self.nextthink = time;
}
};
void() player_flashlight =
{
local entity newflashlight;
newflashlight = spawn();
newflashlight.pflags = PFLAGS_FULLDYNAMIC;
newflashlight.light_lev = 1024;
newflashlight.color = '2 2 2';
newflashlight.skin = 200;
newflashlight.owner = self;
self.flashlight = newflashlight;
newflashlight.think = flashlight_think;
newflashlight.nextthink = time;
};
void () player_flashlight_toggle =
{
if (self.flashlight_state == FALSE)
{
self.flashlight_state = TRUE;
player_flashlight();
}
else
{
self.flashlight_state = FALSE;
self.flashlight.think = SUB_Remove;
self.flashlight.nextthink = time;
}
};
My second problem is also related to the above; I notice corpses and gibs and stuff like that have very jerky movement when they are placed on lifts (it's easy to see if you kill the grunt in the first lift in E1M1). Is there any way to fix that, too?
Thanks.
-

Nash - Posts: 95
- Joined: Fri Oct 19, 2007 5:56 pm
- Location: Kuala Lumpur, Malaysia
For keeping up with the player it may be because you have
self.nextthink = time;
which in actuality isn't the fastest possible run through that code.
Workarounds would be akin to you "attach light to entity out in front " simply make an entity, tag it to (player origin / nonexistant tag on player), offset it forward on the player, and give it the light effects you desire.
see: SetAttachment function in dpextensions.qc
Also possibly moving the light closer to player kind of changes the illusion. You could lower light_lev and set it to v_forward by 10 units.
self.nextthink = time;
which in actuality isn't the fastest possible run through that code.
Workarounds would be akin to you "attach light to entity out in front " simply make an entity, tag it to (player origin / nonexistant tag on player), offset it forward on the player, and give it the light effects you desire.
see: SetAttachment function in dpextensions.qc
Also possibly moving the light closer to player kind of changes the illusion. You could lower light_lev and set it to v_forward by 10 units.
- Chris
- Posts: 79
- Joined: Sat Aug 05, 2006 5:31 am
is there a new "updated" code out there maybe?
if i use this code on my mod with darkplaces, the complete screen got brighter instead of only a "light-stripe" as seen on doom3 flashlight.
seems actually that "http://www.inside3d.com/qctut/qctut-8.shtml" looks better, if there is no fix for this
if i use this code on my mod with darkplaces, the complete screen got brighter instead of only a "light-stripe" as seen on doom3 flashlight.
seems actually that "http://www.inside3d.com/qctut/qctut-8.shtml" looks better, if there is no fix for this
-

skite2001 - Posts: 17
- Joined: Mon Nov 17, 2008 5:40 pm
the code above uses a cubemap for the light effect.
if you provide only the code and not the cubemap then you get a uniform light that shines in all directions and not just infront.
if you provide only the code and not the cubemap then you get a uniform light that shines in all directions and not just infront.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
