Jump to content

Use objects from the scene editor


Guest heyjeebus
 Share

Recommended Posts

Guest heyjeebus

Hey there !

 

Before I buy the engine I have another question:

 

Is it possible to use any object from the scene editor into the game ? If so, how easy is it ?

 

Example: I put an ammo crate in the scene editor, I make my game load the scene, and I want players to be able to pick it up.

Another example: I want players to be able to use a switch from a level to turn a light off.

Link to comment
Share on other sites

It's not that hard. You will of course have to do some programming, but it's about the same amount of work as any other generic engine. There's no prebuilt "pick up an item" code, you'll have to implement an inventory system and add code to remove it from the scene and add it to inventory. There may be some stuff like that in gamelib (a community maintained library), but I haven't worked with it so not sure.

Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX

ZBrush - Blender

Link to comment
Share on other sites

picking up objects: Stuff like this is certainly possible. You need a littlle programming experience to do this or you can ask at the programmers section of the forum. I shouldn't be to hard to create this.

using a switch: kinda the same like above. The engine comes with a few examples scenes. one of the scene is a tunnel scene where there is switch. this switch can be used to turn on and of a rotating fan. For a light to go on and off you can use the same functionality.

Link to comment
Share on other sites

Yeah, picking up objects, moving objects, and inventory system will come to gamelib also.

 

Although its not officially maintained by Leadwerks, you still get a tested and working library with reusable functions for your game, so you don't have to code everything from scratch.

 

I think I'll also split gamelib into seperate class files in future, so you can use only parts of gamelib.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Also, you can request from the community some functionality via lua objects. These would be objects that have functionality in them already that you can use in the editor. I'm a real big fan of this, and think more people should start requesting functionality and more programmers making objects.

Link to comment
Share on other sites

One of the examples actually has a switch the player can switch on and off to enable or disable a large fan.

 

You can use the calc velocity and omega functions to calculate forces to make a body stay at a precise orientation. Another way to do this would be to create a body that represents the player's hands, and create a fixed joint between it and the object you want the player to

pick up.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Guest heyjeebus

Thanks for the replies everyone !

However I think I got misunderstood, what I meant exactly was if it was possible to use any object from a loaded scene.

Here's a piece of imaginary code, hopefully you'll get what I mean:

 

You create your scene and put a ammo crate model in it.

 

the code to use it in game is as follows:


level=LoadScene("garage.scene")

ammocrate=GetObjectFromScene("ammocrateobject",level)

While (end==false)
{

If KeyHit(up)
MoveObject(ammocrate,0,5,0)

}

 

What this piece of code does exactly is loading a scene made in the Leadwerks scene editor, then create a new entity based on an object from the scene(ammocrateobject). Then,in the game loop, if the player presses the up arrow, it will put the ammo crate 5 units higher than it's original position.

 

I hope you understand what I mean. :lol:

Link to comment
Share on other sites

You can name the crate "MyCrate" in the editor, and then do this:

 

scene=LoadScene("garage.sbx")

ammocrate=FindChild(scene,"MyCrate")

While (end==false)
{
If KeyHit(KEY_UP)
MoveEntity(ammocrate,Vec3(0,5,0))
}

My job is to make tools you love, with the features you want, and performance you can't live without.

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...