[Suggestion] x, y, z = translate()

Or how to get the translation?

@TokOut I’m not sure how to respond to you. You just posted a 2000 line program (Minefield) that took a lot of time and experience to write. There are a lot of translate statements in that code, yet you’re asking for an explanation on how to use translate. It seems that someone who can write a 2000 line program that works pretty well, should be able to read the build in reference or at least use Google for what you want.

I am suggesting to add this. In the Reference it’s said, that translate has arguments X, Y and optional Z, but it doesn’t require anything.

Also don’t forget to mention the filler system, … * I am quiet *

Which translate are you asking about. Graphics.transform.translate or Vector.matrix.translate.

If you want to get the current translation position, you can do it like this

local m=modelMatrix()
x,y,z = m[13],m[14],m[15]

But if you want to get answers to your questions, you need to explain them a lot more clearly

The normal translate, how to return it’s values

Use more words to explain

fill(255, 255)
local d = fill() -- We return the fill color

translate(50, 50)
local x, y, z = translate() -- Please add!!
translate(-x, -y, -z) -- Come back to 0, 0, 0

I gave you the answer to that already!

Put a pushMatrix() and a popMatrix() before and after the translate and the other code that uses it. Or you can do a translate(-50,-50). It’s all explained in the reference for translate.

function setup()
    translate(50, 60, 1000)
    local m=modelMatrix()
    for a, b in ipairs(m) do
        print(a, b)

Cannot index a matrix outside range 1 to 16
stack traceback:
	[C]: in ?
	[C]: in for iterator 'for iterator'
	Main:5: in function 'setup'

The commented is the error the m returns

Why are you using a for loop? ModelMatirx is not a table

For the second time, this is how to do it

local m=modelMatrix()
x,y,z = m[13],m[14],m[15]

@TokOut modelMatrix() returns a matrix.

But what’s a matrix?

Have you ever heard of Google. Try that.

There is no reason to be rude. Instead of “Have you ever heard of Google. Try that” Try something like this … “Hey man, I don’t know the answer you are looking for, but I am sure you could find out by looking around a bit. Good luck!” … but what do I know? I am only 13.

@EvanDavis I don’t know how many times TokOut has been told to either read the Codea reference or to use Google when he has a question about something. We’re not his personal reference. He can read the Codea reference or search Google just as easy as we can. Besides, the answers we give him might not be what he’s looking for anyways. We’re here to help when someone has a problem, not to do his reading for him. He’s not only wasting our time, he’s wasting his.

Dave is speaking the truth.

@dave1707, so let’s go to C. Reference: I am sure there aren’t 50% of the Lua tags, then because of your Lua edits, 25% sites in the web are lying how to develop with Codea. I am sure IO is a part of Lua which is not avaibel in Codea, but on many sites.

Going to search for Lua functions;

  • Lua doesn’t even have the setup, draw or touched functions

The Lua articles on the web are for the Windows Lua - that means that there won’t be teached about touches. Then I am going to add today Codea Wikia, so people can create pages for every tag, maybe then smt will be easier

@Tokout, let’s take this thread as an example. Before asking what’s a matrix, you could have looked it up in Codea. I have also referred you numerous times to stuff I have written that explains matrices among other things. If you read those and then asked to clarify something, that’s fine, you tried - but just asking “what is a matrix” is lazy.

All Dave is saying, is do a little research yourself before putting up basic questions. Why should we bother to answer if you can’t be bothered to look?