Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[HELP] md2 with two models
#1
Hi Marcus,

I would like to put two models of md2 on the left (texture2) and and on the right (texture1), 

       
click the images to zoom in

so they should stand face to face and ready to fight (such as in Street Fighter). 

Question #1
What's wrong with this code ? only 1 texture model is drawn.
Code:
    'model 1: Translate and rotate.
    pos = 1.5 'on the right
    S3D_Translate(pos, 0.25, distance)
    S3D_RotateY(rad(rotY))
    S3D_Texture(texture)
    anim.Render(model)

    'model 2
    pos = -1 'on the left
    S3D_Translate(-1, 0.25, distance)
    S3D_RotateY(rad(rotY))
    S3D_Texture(texture2)
    anim.Render(model)
 
Question #2
What is the best way for collision detection between the 3D models ?

You may reply on the weekend, when you are not working. Don't worry, it's not urgent. Big Grin
Thank you


Attached Files
.n7   test.n7 (Size: 12.2 KB / Downloads: 3)
Reply
#2
He's actually somewhere behind the "camera" Smile

The transformations (S3D_Translate, S3D_Rotate) you apply to position the first guy are still in effect when you position the second guy. Among all, you've applied a rotation along the y-axis, resulting in an x-axis that is pointing straight into the screen (so, the negative x value in the second S3D_Translate puts the other guy behind the camera).

Push and pop when drawing objects to restore the transformation matrix and you'll be fine.

Code:
    'model 1: Translate and rotate.
    pos = 1.5 'on the right
    S3D_Push()
    S3D_Translate(pos, 0.25, distance)
    S3D_RotateY(rad(rotY))
    S3D_Texture(texture)
    anim.Render(model)
    S3D_Pop()

    'model 2
    pos = -1 'on the left
    S3D_Push()
    S3D_Translate(-1, 0.25, distance)
    S3D_RotateY(rad(rotY))
    S3D_Texture(texture2)
    anim.Render(model)
    S3D_Pop()

The second question will have to wait, but probably the answer will be about cheating - actually trying to determine which triangles intersect with eachother would be very inefficient. In the robowack 3-demo the player can collide with enemies and enemies with other enemies, but those are just simple 2d tests combined with push away-effects.
Reply
#3
Thanks, Marcus !
It's working well 

Big Grin
Reply
#4
(09-09-2025, 09:21 AM)1micha.elok Wrote: Thanks, Marcus !
It's working well 

Big Grin

Cool! Tekken but with DOOM Guy!

I'm into an experiment with something Star Fox (SNES) like these days. But ... Star Wars: Outlaws on Switch 2 kind of prevents me from programming after work Big Grin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)