Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Giving 2D shapes a Z coordnate

This task is very simple the way I use it. So, ~ellipse(200,200,50)~ doesn't have any Z, seen that yet? (I bet so.) Take this for example:
You have a 3D multi-player game like Ignatz. He has a 3D castle war game. How are you supposed to know where your opponent is? Sure, you can put text on the screen to show where your opponent is.
(Note I have NEVER once used multi-player function. I don't know that this is correct)
But, this looks like too much work.

ortho()
viewMatrix(matrix())
fill(255,255,255)
text("Opponent X: " ..opp.x)
text("Opponent Y: " ..opp.y)
text("Opponent Z: " ..opp.z)
popMatrix()

But, its as simple as this to give a 2D shape a Z coordnate:

translate(yourX, yourY, yourZ)
ellipse(yourX, yourY, 50)
Tagged:

Comments

  • IgnatzIgnatz Mod
    edited May 2015 Posts: 5,396

    it should be ellipse(0,0, 50)

    Also, if you want to always see the picture from the front, you need to rotate it. I have more than one post showing how to do this.

  • Posts: 2,020

    Have you looked at the "3D Lab" example program that comes with Codea? If you slide the "scene select" slider over to 2 there's an example of what you're describing, projecting a 2D plane in 3D space.

Sign In or Register to comment.