Author Topic: jo_sin_mult/jo_cos_mult return smaller/bigger value  (Read 1258 times)

surt_r

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
jo_sin_mult/jo_cos_mult return smaller/bigger value
« 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
« Last Edit: November 07, 2016, 02:29:21 am by surt_r »

mindslight

  • Administrator
  • Full Member
  • *****
  • Posts: 157
  • Karma: +6/-1
    • View Profile
    • Jo Engine
Re: jo_sin_mult/jo_cos_mult return smaller/bigger value
« Reply #1 on: November 07, 2016, 09:30:50 am »
Hi,

I will answer you as soon as possible :)

mindslight

  • Administrator
  • Full Member
  • *****
  • Posts: 157
  • Karma: +6/-1
    • View Profile
    • Jo Engine
Re: jo_sin_mult/jo_cos_mult return smaller/bigger value
« Reply #2 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/

Danny

  • Newbie
  • *
  • Posts: 32
  • Karma: +3/-0
    • View Profile
Re: jo_sin_mult/jo_cos_mult return smaller/bigger value
« Reply #3 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.

surt_r

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: jo_sin_mult/jo_cos_mult return smaller/bigger value
« Reply #4 on: December 24, 2016, 02:43:17 am »
Thanks for the fix! I'll continue working on it.

 

Sitemap 1 2 3 4 5 6 7 8 9 10 
SMF spam blocked by CleanTalk