About Store Forum Documentation Contact



Post Reply 
Pickup actor or object
Author Message
Xardas Offline
Member

Post: #1
Pickup actor or object
Hi, I am quite impressed by this engine, but there are still some things that I need to wrap my head around.

For example, how do I create a simple pickup object, that triggers a function when I (the player character) or an AI "entity" walks into the trigger volume? I don't wan't to check every frame if I am "colliding" with the volume. I want to create and place the object in the world editor and have it automatically trigger when I enter the volume.

Most engines use components these days, which I am familiar with. But what is the intended way to do it in Esenthel?

Thank you.
08-08-2018 09:10 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Pickup actor or object
Hi,

Quote:I don't wan't to check every frame if I am "colliding" with the volume.
that's one way to do it.

Alternatively you can try using this tutorial:
Code:
/******************************************************************************/
Actor ground,
      ball,
      box;
PhysMtrl bouncy;
bool triggered;
/******************************************************************************/
void ReportTrigger(ActorInfo &trigger, ActorInfo &actor, PHYS_CONTACT contact)
{
   triggered=true;
}
/******************************************************************************/
void InitPre()
{
   EE_INIT();
   Ms.hide();
   Ms.clip(null, 1);
}
bool Init()
{
   Cam.dist=4;
   Physics.create(EE_PHYSX_DLL_PATH);

   bouncy.create().bounciness(1).bouncinessMode(PhysMtrl.MODE_MAX).damping(0);

   ground.create(Box(15, 1, 15, Vec(0, -3, 0)), 0);

   ball.create(Ball(0.5, Vec(0, 2, 0))).material(&bouncy); // adjust material to bouncy

   box.create(Box(0.5, Vec(0, 0, 0))).trigger(true).gravity(false); // set box as trigger

   Physics.reportTrigger(ReportTrigger); // set callback function

   return true;
}
/******************************************************************************/
void Shut()
{
}
/******************************************************************************/
bool Update()
{
   if(Kb.bp(KB_ESC))return false;
   Cam.transformByMouse(0.1, 10, CAMH_ZOOM|(Ms.b(1)?CAMH_MOVE:CAMH_ROT)); // move camera on right mouse button

   triggered=false; // set no trigger before the simulation
   Physics.startSimulation().stopSimulation();

   return true;
}
/******************************************************************************/
void Draw()
{
   D      .clear();
   Physics.draw ();
   if(triggered)D.text(0, 0.9, "triggered");
}
/******************************************************************************/
08-08-2018 09:40 AM
Find all posts by this user Quote this message in a reply
Xardas Offline
Member

Post: #3
RE: Pickup actor or object
Thank you, I'll try that!

Btw, I've just switched from the Steam version to the one offered on your website. I did it because it said the Bloody Massacre project did not work with the version from Steam. It now works with the regular version, but I've noticed a significant increase in CPU usage when using the Esenthel Editor from the website...Vsync is already enabled (default).

Also, after getting a license, am I free to use any assets provided with the engine in a commercial product?
08-08-2018 10:48 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Pickup actor or object
Hi,

The CPU usage should be only if the Editor is processing some things in the background, like downloading an Engine update, or processing some Worlds (optimizing terrain meshes).

It will go down after it finishes.

Most of the assets are free to use, but it's difficult for me to imagine you'd like to use them in a final product as they're only basic bare bones.
08-08-2018 11:18 AM
Find all posts by this user Quote this message in a reply
Xardas Offline
Member

Post: #5
RE: Pickup actor or object
Weird, I just double checked and there doesn't appear to be a difference between the two version with regards to CPU usage.

Either one takes up 10-20% just having a code file open according to Windows task manager. Disabling vsync makes it shoot up to ~40% (understandably).
08-08-2018 11:43 AM
Find all posts by this user Quote this message in a reply
Post Reply