Jump to content

SBX questions


Raul
 Share

Recommended Posts

This is first time I used the editor in order to create a scene for myself and I have some questions:

 

1. I understand the "vegetation" does not have a physic model. So it's good to be used only for 3D grass, bushes, trees outside the "playing area", etc.

2. How to enable the wind effect which I can see in the editor?

3. How can I enable in my game the vegetation shadow?

4. I have added some trees (GMF files) on my map. If I enable the "Physics" I can see they have a physic model. In my game my character (which is made by a Controller) can simply walk through them. I also enabled the PhysicsDebug in the game and I can see the red lines..

 

5. Is somewhere here a "tutorial" or anything like that regarding how to load and manipualte a SBX file?

i5 2.7Ghz, GTS 450, 8GB Ram, Win7 x64; Win8 x64

rvlgames.com - my games

RVL Games Facebook Page, YouTube Channel

 

Blitzmax :)

Link to comment
Share on other sites

1. It will have in the next update.

2. There is no wind effect in editor. You can make wind by adding a force to all physics bodies. You can make it a simple function like DoWind() which loops through all physics bodies using ForEachEntityDo(..., ENTITY_BODY ).

3. http://www.leadwerks.com/wiki/index.php?title=Terrain#SetVegetationShadowMode

4. You need to assign a collision number to the trees, and tell the engine that this number collides with your player collision number (Commands needed: EntityType(), Collisions() ).

5. The best way to manipulate a sbx file is using Editor. The LoadScene() command loads a sbx file pretty well when you have the required engine folders in your project (entities, scripts).

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

Regarding point no.4:

 

"You need to assign a collision number to the trees".. I assume I have to loops through all trees and set the EntityType to 2 lets say, but how can I do this?

I need to use same technique to retrieve the terrain for no.3 I think.

i5 2.7Ghz, GTS 450, 8GB Ram, Win7 x64; Win8 x64

rvlgames.com - my games

RVL Games Facebook Page, YouTube Channel

 

Blitzmax :)

Link to comment
Share on other sites

It's a bit complicated to get the terrain by default, you need to loop through all entites which are child of the loaded scene entity and search for an entitykey called "class"="Terrain". Gamelib does this automatically when you use game.scene.LoadMap(), and then you have the terrain entity in game.scene.terrain.

 

To set the entitytype of all trees to 2, you just need to select all trees in Editor (root entity -> select all) and change their entitytype in the property box (it applies to all selected entities then). So it's just 7 mouseclicks (root entity -> select all, instance entity -> properties -> physics -> collision -> Apply) to change the entitytype for all models of the same class.

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

for 2.2X, just create an INI text file with the same name as the GMF, and write this in it:

collisiontype=2

and save it in the same place as the tree's GMF file.

 

when you upgrade to 2.3, you can replace the need for INI files with lua script

 

..or you can just do like lumooja was saying to do, select all the instances, then open up the properties window and hit the New button and create a new key/value of collisiontype/2...

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Thanks. I tried with "collisiontype=2" in the ini file but nothing happens. In the same INI file there is a LODdistance="20 140" so I tried writing "2" between "" too and also nothing happens.

 

I have in my code the following lines:

 

LoadScene("map.sbx");

Collisions();

Collisions(1,2,1);

 

Before calling the LoadScene I create the Controller also with type = 1

 

EDIT:

In the properties window now I can see the "collisiontype" and the value 2...

i5 2.7Ghz, GTS 450, 8GB Ram, Win7 x64; Win8 x64

rvlgames.com - my games

RVL Games Facebook Page, YouTube Channel

 

Blitzmax :)

Link to comment
Share on other sites

Please guys help me.

 

I rechecked the whole things. I have the collisiontype=2 in the ini file but IS NOT WORKING.

 

This is my code:

 

EntityType(PlayerController,1);
SetBodyMass(PlayerController,80);
myMap.CreateMap();
Collisions(1,1,1);
Collisions(1,2,1);

 

Also I have added some boxes in the scene (from my code not from Sandbox) and they are falling on the terrain, so there is no mistake in my code..

i5 2.7Ghz, GTS 450, 8GB Ram, Win7 x64; Win8 x64

rvlgames.com - my games

RVL Games Facebook Page, YouTube Channel

 

Blitzmax :)

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