726

(29 replies, posted in Scripting)

You might have better result by using a ray-test :
http://wiki.maratis3d.org/index.php?title=RayHit

A bullet is very small so it can miss the collision test I think.

727

(3 replies, posted in General)

use a separate scene to draw all the game interface and call enableCameraLayer :
http://wiki.maratis3d.org/index.php?tit … ameraLayer

728

(2 replies, posted in General)

Your image texture is marked as "generated" not as source image, how did you do the texture ?
I think you need to save the image file or something.

In case you didn't read it yet, there is a tutorial for the blender exporter here : http://www.maratis3d.org/?p=277

Ho, I wanted to ask you, did you use baked lightmaps on your level or only dynamic lights ?

I'm really a fan of the ambiance : ) nice work.
The download link doesn't work for me, my browser tells me there is a redirection loop,
I also have problems with the files on the wiki (it says access non authorised).

731

(8 replies, posted in Engine)

I need to add something to access materials properties, and maybe bones coordinates.

Other things missing ?

732

(8 replies, posted in Engine)

And a second wave, the code is on svn ! :

- general :
getChilds(object) > return a list of all childs (if any)
getWindowScale() > return a table[2]
getSystemTick()

- shadows :
enableShadow(object, bool)
isCastingShadow(object)

- light properties :
setlightShadowQuality
setlightShadowBias
setlightShadowBlur
getlightShadowQuality
getlightShadowBias
getlightShadowBlur
setlightSpotAngle
setlightSpotExponent
getlightSpotAngle
getlightSpotExponent

- physics :
getMass
setMass
getFriction
setFriction
getRestitution
setRestitution
getAngularFactor
setAngularFactor
getLinearFactor
setLinearFactor
getCentralForce
getTorque

733

(8 replies, posted in Engine)

I'm starting a code session to improve the lua integration of Maratis engine as a lot of feature are still missing,
the first wave is already on svn, with a focus on vector manipulation and object.

I added a minimal vector manipulation for 3d vector, compatible with the current table system,
allowing basic math (addition, multiplication etc), for example :

pos = (getPosition(object) + vec3(1, 0, 0)) * 2

-- it's still a table like before :
x = pos[1]
y = pos[2]
z = pos[3]

With the classic math :

length(vec)        > return a number
normalize(vec)        > return a vec3
dot(veca, vecb)        > return a number
cross(veca, vecb)    > return a vec3


Plus some object missing functions (there is still a lot missing) :

- object data
isActive(object)
getName(object)
getParent(object)
setParent(object, parent)

- to get object global coordinates (if parenting) :
getTransformedPosition(object)
getTransformedRotation(object)   
getTransformedScale(object)
   
-- some vector/matrix manipulation :
getInverseRotatedVector(object, vec)
getRotatedVector(object, vec)
getInverseVector(object, vec)
getTransformedVector(object, vec)
updateMatrix(object)
getMatrix(object) > return a table of 16 entries

I agree that Blender is trying to do too much things, but I find modeling really simple and powerful, I was originally a 3dsmax user and would never go back. Blender animation system is a bit complex to use, and from my experience texture painting is a bit buggy, but I find the sculpting tools really great. We have the chance to have multiple free 3d softwares available, the best is to use each one for what it's doing the best.

What I'd like to see is an exemple of this Blender addon to bake lighting for a Maratis level.
Someone also talked about a lightmap software called Giles : http://www.frecle.net/index.php?show=giles.screenshots
looks interesting too.

735

(29 replies, posted in Scripting)

For exemple, when the player fire, you can initialize the bullet position and rotation according to the player :

    if onKeyDown("MOUSE_BUTTON1") then 
        pos = getPosition(player)
        rot = getRotation(player)

        -- init bullet transform
        setPosition(bullet, pos)
        setRotation(bullet, rot)

        -- if necessary move the bullet up or down, or rotate if not in the good direction :
        translate(bullet, {0, 0, 1}) -- random example you may not need it
        rotate(bullet, {1, 0, 0}, 90) -- random example you may not need it
    end

    if firing == 1 then 
        translate(bullet, {0.5, 0, 0}, "local")
    end

736

(29 replies, posted in Scripting)

if the bullet is linked to the player, the coordinates are local to player,
you should probably not link the bullets to the player because if the player rotate when the bullet is fired the bullet will rotate with it.

737

(3 replies, posted in Gossip)

The talk by Bret Victor is very interesting, I remember seeing the mario-like video somewhere.
Some of the real-time code modification might be a bit complex to do, but as lua is quite fast to 'compile' it would be interesting to try. For a timelapse, a basic system would be to record all inputs at 60hz and to recompute the logic loop when the script is modified (I'm not sure it will be realistic for a big game or a long timelapse).

738

(14 replies, posted in General)

I opened it, your object scale x is negative, that's why it revert the normals.

apply the transform first, recalculate the normals and you can use edge split :

http://www.maratis3d.com/tmp/blender.jpg

739

(4 replies, posted in Scripting)

I think it's the reverse, and not local :

force = {corepos[1] - playerpos[1], corepos[2] - playerpos[2], corepos[3] - playerpos[3]}


addCentralForce(player, force)

you also might need to normalize the force vector :

function getLength3d(vec)

    return math.sqrt(vec[1]*vec[1] + vec[2]*vec[2] + vec[3]*vec[3])

end

function normalize3d(vec)

    length = getLength3d(vec)
    vec[1] = vec[1] / length
    vec[2] = vec[2] / length
    vec[3] = vec[3] / length
    return vec

end

740

(4 replies, posted in Scripting)

set the gravity to zero, set the objects physics and use "addCentralForce" :
http://wiki.maratis3d.org/index.php?tit … ntralForce

741

(4 replies, posted in Scripting)

mh.. I think I found an error in the code, when sending tables,
that explain why it works with boolean and string but not there...

I submitted a fix on svn.

742

(14 replies, posted in General)

Your normals look inverted :

in blender, go to edit mode, select all, go to Mesh > Normals > Flip Normals

743

(4 replies, posted in Scripting)

getBehaviorVariable(Cam, 0, "offset") is good, it is used like that :

offset = getBehaviorVariable(Cam, 0, "offset")
x = offset[1]
y = offset[2]
z = offset[3]

to set the variable it should be :

setBehaviorVariable(Cam, 0, "offset", {x, y, z})

744

(3 replies, posted in General)

The animation can make the bounding box bigger, so it depend how the physics is setup.
Generally, the physics is set to a separate object (one box for the boy, one for the feet to detect the ground etc),

Vegas explain it in his website : http://dl.dropbox.com/u/19970067/Site/Mara_YoFrank.html

745

(14 replies, posted in General)

some of your objects seems to have their normals inverted.
also, set spot exponent to 0 and put the spot further with a bigger radius.

As your scene is outside, you should also use some emit in your material (grey/blue).

746

(1 replies, posted in Scripting)

Hi,

it's not silly, it's actually missing in lua, let's add it to the todo list.

The only thing possible for now is to do it in c++ using the plugin system,
or to duplicate all the objects in the editor and deactivate them (you can then activate in lua).

747

(15 replies, posted in Scripting)

It's not "IsKeyPressed" it's "isKeyPressed" :

text = getObject("text")
val = 0

function increment(i)
    return i + 1
end

function onSceneUpdate()
    setText(text, val)
    if isKeyPressed("W") then
        val = increment(val) -- Calling function increment
    end
end

It's named increment only for logic sake.
Function arguments are only local to the function so it's generic like a rule or a mathematical function.
When you call the function you pass it any variable in argument.

748

(15 replies, posted in Scripting)

I'll also suggest you should not use the same name "i" for the argument and the global variable to not be confused :

text = getObject("text")
val = 0

function increment(i)
    return i + 1
end

function onSceneUpdate()
    setText(text, val)
    if IsKeyPressed("W") then
        val = increment(val) -- Calling function increment
    end
end

749

(15 replies, posted in Scripting)

Using "return" in a function means that the function return the result when you call it,
it means in your case that you have to write "if IsKeyPressed("W") then i = increment(i)"

750

(24 replies, posted in Engine)

3dcat : Yes, at some point a material editor will be necessary.

For now, Blender cannot preview shaders for Maratis, but once your model is exported from Blender and displayed in Maratis open your shader with a text editor, when you save the shader it will update automatically in Maratis.

Linking the shaders in Blender :
http://www.maratis3d.com/wp-content/uploads/2011/01/05.jpg

Look at "Custom shaders" example to see how to write GLSL shaders for Maratis : http://www.maratis3d.org/?page_id=53