Jump to content

Few questions on Lua/Le


Joh
 Share

Recommended Posts

In c++/bmax we use collision callback to have infos from collision wath i should use on lua?

Is there any way to create a vector/list on lua?

Thx.

Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10.

Link to comment
Share on other sites

Anyone known? Seem really strange.. There is nobody who need to check collision on theyr game using lua?

I think to have found a sort of solution for list/vector.

Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10.

Link to comment
Share on other sites

I need to check it before.. Lua array are undefinited, so you can create an array like this:

 

array = {}
for i=1, 100 do
     array[i] = 0
end

 

In this case we could do something like this i guess:

 

Function addLast (a)
     array[counter] = a
     counter = counter + 1
end

Function removeFirst()
     a = array[0]
     for i=0, counter-1
           array[i] = array [i+1]
     end
     array[counter] = nil
     counter = counter - 1
     return a
end 

 

I need to check it, it obviously not a list but it can work.

Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10.

Link to comment
Share on other sites

Hi,

Table is the best way to go! however you can also use Vec2,Vec3,Vec4 functions to create 2/3/4 dimentional vectors.

vec1=Vec3(0,0,0)

 

about collisions, LE have a object:Collision() function that runs when a collision occures. you can use it like this :

function object:Collision(entity,position,normal,force,speed)
    ...
end

 

where Entity is the entity that collided this object.

 

you can see "oildrum.lua" (oildrum script) for example

  • Upvote 1
Link to comment
Share on other sites

Mmm seem this doesn't help me at all.

What i am trying to do if check if a body (created by code) is collided or not. I don't need to know more other infos, just if it's collided.

The oildrum code it's seem a little different it created a class for a model and so took the object and check the collision.. Did i need to create an empty gmf and create a lua file as oildrum have?

Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10.

Link to comment
Share on other sites

There is a collision object function you can use with models.

That was my tought there is no way to check the collision from the body itself.. To do this i should modify all the models to handle collision with that body OR create an "empty" model to do this..

So for example if i wanna check the collision from 2 bodies created directly on code?

Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...