401

(3 replies, posted in Scripting)

you can calculate the length of the current position minus the last frame position of an object,
in lua :

velocity = length(currentPos - lastPos)

402

(8 replies, posted in General)

I will let you know when it's on, I know there is a revival of pixel art style and this should be simple to do.

403

(8 replies, posted in General)

Hi,

mip mapping is not the same thing, it is a technique to sample a texture in multiple sizes,
what you want is to change the texture filter mode : nearest vs linear

it is actually not there in maratis mesh format yet, but you can change a texture filter mode in c++.
We'll try to add this soon.

You can inspire what is done in lua to do the same in c++,
follow what I said and remember to always use physCont->addCentralForce to move objects with physics

405

(8 replies, posted in General)

? who got your password ?

For a camera, you can replicate what is done in Jules demo in lua but in c++,
basically apply physics to an invisible box (with sphere collision shape) with very low mass (0.001 for example) that follow your player or else, and link the camera to this box so the camera will collide walls.

if the physics of your entity and level is enabled in editor you don't need to enable it in code.

do you want to replicate something like the jules movement or sponza in c++ ? with gravity ?
if you want the entity to bounce/slide you don't need to stop the entity manually, let the physics handle it.

also, who do you want to move, "parent" or "ent" ?

first, enable physics in editor (be sure entity has a mass > 0)
then move the entity with physCont->addCentralForce only :

        MPhysicsContext * physCont = engine->getPhysicsContext();
        MVector3 rot = parent->getTransformedRotation();
        MPhysicsProperties * phyProps = parent->getPhysicsProperties(); // use parent physics prop if you want to move the parent

        MVector3 dir;
        dir.x = sin(rot.y)*speed;
        dir.y = cos(rot.y)*speed;
        dir.z = sin(rot.y)*speed;

        physCont->addCentralForce(phyProps->getCollisionObjectId(), dir);

408

(8 replies, posted in General)

Hi, are you on linux, windows ?

your models are too high poly for sure, but if you have a speed difference between fixed and standard renderer it is most probably because your drivers are not up to date or not accelerated. For example, on linux if you don't have native AMD drivers, the rendering will be done by the CPU and not the GPU (no acceleration), same for windows. Try to install AMD drivers.

409

(3 replies, posted in Gossip)

Best luck to you too,
feel welcome anytime smile

Hi,

you sure it's not :

if (physCont->isObjectInCollision(phyProps->getCollisionObjectId()) == 0) // 0 collisions so move
{
    parent->setPosition(pos);
}

how is the collision shape of your entity, and is the physics enabled in the entity and in the level ?

Also let's say you are using the entity bounding box,
once you collide with the level and cannot move it means the entity will be stuck because it cannot move when in collision.

Also, when dealing with physics objects, it's better to move them with physCont->addCentralForce instead of setPosition.
isObjectInCollision returns the number of collision the entity is with.

Can you detail how exactly you want the entity to interact ?

411

(7 replies, posted in Scripting)

Hi,

there is only one script running at a time,
in your case the scene 1 because it is the active scene.

So write all code in the scene 1 script :

Scene 1 code:
GuiScene = getScene("Pnt_scene")
Camera = getObject("camera0")
enableCameraLayer(Camera, GuiScene)

txt_points = getObject(GuiScene, "Text0") -- get object from GuiScene
t = 0

function onSceneUpdate()
       t = t + 1
       new_text = "Time = " .. t -- change the last "t" to display another info
       setText(txt_points, new_text)
end

412

(42 replies, posted in Showcase)

It looks good, I like your rocks in the desert and the light of Terminal,
the design of the tree in FunLand is also good, it's good material for a mario-like game or a cartton universe.

413

(4 replies, posted in General)

the function needs to return an int,
0 if the lua function doesn't return anything,
1 if the function returns 1 value, 2 for 2 values etc.

You can send values to lua using MScriptContext pushInt, pushString...
And get arguments from the lua call using getInteger, getString...

exemple :

#include <MEngine.h>
#include "MyPlugin.h"

int myFunction(void)
{
    MEngine * engine = MEngine::getInstance();
    MScriptContext * script = engine->getScriptContext();
    script->pushString("Hello World !");
    return 1;
}

void StartPlugin(void)
{
    MEngine * engine = MEngine::getInstance();
    MScriptContext* script = engine->getScriptContext();

    script->addFunction("myFunction", myFunction);
}

In lua the function will be used like this :

text = myFunction() -- "Hello World !"

414

(4 replies, posted in General)

Hi,
yes you can add custom function using a game plugin with MScriptContext :

MEngine* engine = MEngine::getInstance();
MScriptContext* script = engine->getScriptContext();
if(script)
    script->addFunction("myFunction", myFunction);

415

(4 replies, posted in Engine)

Hi,
because it's hard to maintain multiple projects,
only the scons build system is up to date.

you can run scons from visual studio normally :
http://www.scons.org/wiki/IDEIntegration
http://www.mereidea.com/blog/2009/05/07 … al-studio/

and you can run scons in debug mode with this command :
python scons.py build_mode=debug

if you don't manage to create a visual project using scons,
you can always compile a debug executable using "python scons.py build_mode=debug"
and debug it in visual studio afterwards :

You can debug any executable by building a debug version of the code at the command line (for example, use scons -Q debug=true to build our example code). Open Visual Studio, and create a new, general, empty project. Choose to insert an existing project, and in the dialog select Executable files as the file type. Then browse to the executable you want to debug, and load it in. Set it as your start up project, and then you can either open a file containing the code you want to debug, place a breakpoint and start debugging (F5), or start at the beginning of the executable with Step Into from the Debug menu (or F11).

416

(1 replies, posted in Scripting)

oh yes alright,
I did not make the connexion, thank you.

417

(1 replies, posted in Bug report)

thanks,
I'll keep an eye on that.

418

(11 replies, posted in General)

Try to use the codeblocks project from this example : http://www.maratis3d.org/download/WaterGameDemo.zip
I don't have access to linux right now to test your file.

Some infos in case :
- don't use maratis source code from svn, just link to the headers of MCore and MEngine present with the release of Maratis you downloaded.
- don't compile MCore and MEngine, just link to it.
- compile in release
- name the plugin "Game.so" (not libGame.so)

419

(11 replies, posted in General)

did you build it in "release" mode ? ("debug" mode won't work)

420

(11 replies, posted in General)

the plugin needs to be named "Game.so".

Be also sure it's in your maratis project directory.

421

(17 replies, posted in Showcase)

it should not be too complicated.
you can add a function using the script context.

some custom shader examples : http://www.maratis3d.org/?p=548

the last option is to use a custom shader, where you control everything (it can be faster as you can remove all lighting calculation)

424

(10 replies, posted in General)

Yes, as Argoon says, rayHit() uses and so requires physics.
It's actually the simplest way to detect mouse over in lua.

425

(13 replies, posted in General)

I never got it, strange, I use chrome.