Spike wrote:when I said that customphysics replaced logic including think functions, what I meant was that think functions on the entity will no longer happen, meaning you need to call them yourself if you still want them to happen.
Thanks a lot Spike, now I get it! For those wondering what customphysics does, but to lazy to test it
Code: Select all
void myplayerspawn()
{
player.customphysics = physnow;
player.nextthink = time +2;
player.think = thinknow;
}
In thinknow you can increase for example a foo var
Code: Select all
void thinknow()
{
foo +=5;
self.nextthink = time +5;
self.think = thinknow;
}
Now, without calling customphysics, if you cprint foo, you'll see 5...10...15...etc every 2 seconds. Instead, calling customphysics, the var will remain set to 0.
To make thinknow
function make its work, call thinknow directly in .customphysics function
Code: Select all
void physnow()
{
thinknow();//this will make think function work again
}
Thanks a lot Spike, now I now how customphysics work. Practically, if I understood well, .customphysics field is just needed to tell the engine to stop using legacy physics and do physics on your own, instead custom physics function (physnow() in example above) is needed to call think functions that, otherwise, wouldn't be called. It doesn't do any physics at all(only CSQC_Input_Frame() does), right?
--------------------
Spike wrote:note that tracebox does NOT bounce or slide itself
No, I know that. It only traces a bbox using a mins/maxs hull box and check trace_fraction,trace_plane_normal and trace_ent accordingly,right?
Spike wrote:if your start position is directly next to a wall or something and the direction that the box is traced in points even slightly towards that wall, then the tracebox will of course hit that wall instantly, making no progress.
Clear. Basically, if I understood correctly, I have to move every frame tracebox end vector a little further to check if player is not stuck.
Spike wrote:you MUST clip/bounce the velocity according to the trace_plane_normal value reported by tracebox.
velocity += -1 * dot(velocity, trace_plane_normal) * trace_plane_normal;
Thanks, probably this is the part where I fail. I did this
Code: Select all
subject.velocity += -1 * (subject.velocity * trace_plane_normal) *trace_plane_normal;
Is that correct?
But no difference at all. Now I manage to make player falls down, and walk on static meshes, but 1) movements are jerky 2) with thin meshes it falls through them (with static mesh box player walks over it ok)