Topic: [Plugin] LookAt for Entity

PunBB bbcode test

We gonna take the "How to create a game plugin" as base.
http://www.maratis3d.org/?p=500

In your visual c++ project, add these two files (they are in maratis source code folder) :

../Maratis/Common/MBehaviors/MBLookAt.cpp
../Maratis/Common/MBehaviors/MBLookAt.h

Then, in SimpleGamePlugin.cpp, add :

#inculde "MBLookAt.h"

And after the line
behaviorManager->addBehavior(MyBehavior::getStaticName(), M_OBJECT3D, MyBehavior::getNew);

Add
behaviorManager->addBehavior(MBLookAt::getStaticName(), M_OBJECT3D_ENTITY, MBLookAt::getNew);

Compile, Generate & Enjoy

PunBB bbcode test
PunBB bbcode test

(Thanks anael for this wink)

Edit : i screwed up a step when i last edited, corrected now smile

Last edited by Vegas (2011-09-12 10:35:47)

Re: [Plugin] LookAt for Entity

Can anyone compile this for me and send me the dll ? as i cant use visual studio for now i can't do it myself ><

Thanks

Re: [Plugin] LookAt for Entity

I'll try to send you that,
tell me by mail why you are not able to use visual anymore ?

Re: [Plugin] LookAt for Entity

In "SimpleGamePlugin.cpp"

add

behaviorManager->addBehavior(LookAt::getStaticName(), M_OBJECT3D, LookAt::getNew);

is indispensable ? or just optional ?

Re: [Plugin] LookAt for Entity

"addBehavior" is indispensable to add a behavior to the engine.

The first argument is the name of the behavior (as it will appear in maratis interface).
The second argument is a filter, for example, if your behavior should be only applying to a Camera, you should set "M_OBJECT3D_CAMERA". "M_OBJECT3D" means it's available for all 3d objects.
The third argument is a pointer to a function returning a new behavior.

Re: [Plugin] LookAt for Entity

anael wrote:

I'll try to send you that,
tell me by mail why you are not able to use visual anymore ?

I sent the mail , do you received it ? (asking because i'm using another mail client than usual, just checking)

Anyway my problem is still the same as here : http://forum.maratis3d.com/viewtopic.php?id=90