Jo Engine Forum

Sega Saturn Development => General Jo Engine Help => Topic started by: surt_r on November 06, 2016, 12:23:32 am

Title: jo_sin_mult/jo_cos_mult return smaller/bigger value
Post by: surt_r on November 06, 2016, 12:23:32 am
Hello,

I've been adapting Danny's script to work with a dungeon crawler movement (90 degree turns and fixed step movement) to learn how to manage first person movement. However, jo_sin_mult/jo_cos_mult sometimes return a smaller/bigger value (127 or 129 instead of 128) whenever I try to move on the X or Z axis.

Sorry if that's a stupid question, but I'm learning how the engine works and unfortunately the lack of tutorials on the 3D part makes it somewhat confusing at times.

I've attached the test code
Title: Re: jo_sin_mult/jo_cos_mult return smaller/bigger value
Post by: mindslight on November 07, 2016, 09:30:50 am
Hi,

I will answer you as soon as possible :)
Title: Re: jo_sin_mult/jo_cos_mult return smaller/bigger value
Post by: mindslight on November 07, 2016, 11:09:05 am
I found it! :)

It's an approximation bug that I fixed.

Now, the code bellow works perfectly:

Code: [Select]
void my_gamepad(void) {
    if (jo_is_pad1_key_down(JO_KEY_UP) && !lock) {
        speed += SIZE_UNIT;
    }
    if (jo_is_pad1_key_down(JO_KEY_DOWN) && !lock) {
        speed -= SIZE_UNIT;
    }
    if (jo_is_pad1_key_down(JO_KEY_LEFT) && !lock) {
        tangle -= 90;
    }
    if (jo_is_pad1_key_down(JO_KEY_RIGHT) && !lock) {
        tangle += 90;
    }
}

You just need to update the engine : http://www.jo-engine.org/download/
Title: Re: jo_sin_mult/jo_cos_mult return smaller/bigger value
Post by: Danny on November 07, 2016, 03:54:08 pm
Hi,
I know I promised a tutorial about first person movement but I have been busy  :(.
The last code I posted missed the full 3d movement and was not really well structured, sorry about that  :-\.
I will try to make a tutorial this week with a full 3d movement flight camera.
Title: Re: jo_sin_mult/jo_cos_mult return smaller/bigger value
Post by: surt_r on December 24, 2016, 02:43:17 am
Thanks for the fix! I'll continue working on it.