Epoch
(Epoch)
December 15, 2019, 4:39pm
1
Hello, I am attempting to port the Quake 3 movement code into blueprint. What is confusing me is this array used to set velocity.
for (i=0 ; i<3 ; i++) { pm->ps->velocity[i] += accelspeed*wishdir[i]; }
How might I go about creating this in blueprint?
Everynone
(Everynone)
December 15, 2019, 4:57pm
2
I think it’s this but no clue what it’s supposed to achieve without seeing the rest:
Epoch
(Epoch)
December 15, 2019, 5:02pm
3
==============
PM_Accelerate
Handles user intended acceleration
==============
*/
static void PM_Accelerate( vec3_t wishdir, float wishspeed, float accel ) {
#if 1
// q2 style
int i;
float addspeed, accelspeed, currentspeed;
currentspeed = DotProduct (pm->ps->velocity, wishdir);
addspeed = wishspeed - currentspeed;
if (addspeed <= 0) {
return;
}
accelspeed = accel*pml.frametime*wishspeed;
if (accelspeed > addspeed) {
accelspeed = addspeed;
}
for (i=0 ; i<3 ; i++) {
pm->ps->velocity[i] += accelspeed*wishdir[i];
}
Here is the full function
Everynone
(Everynone)
December 15, 2019, 6:11pm
4
Oh, I don’t think these are arrays. They are vectors. That makes more sense. Kind of same thing, tbh.
So you’re writing a character movement component from scratch?
Epoch
(Epoch)
December 15, 2019, 10:46pm
5
I am trying to replicate the movement of Quake 3, I considered doing it directly in C++ but I lack the UE4 C++ experience to do that. If you could point me in the right direction for C++ that would be great as well