forked from daid/EmptyEpsilon
-
Notifications
You must be signed in to change notification settings - Fork 0
Adding 3D models
oznogon edited this page Jan 28, 2020
·
14 revisions
EmptyEpsilon can use OBJ models. To make new OBJ models available for use:
-
Place the OBJ files and any textures in the
EmptyEpsilon/resourcesdirectory. -
Add a
ModelData()entry toEmptyEpsilon/scripts/model_data.lua. For example, the following code:- adds a model named
gentestfrom OBJ filegentest.obj - uses
gentest.pngfor its texture - uses
gentest_diffuse.pngfor its normal (specular/reflective) map - uses
gentest_illumination.pngfor its illumination map - scales the model up 24x
- sets its in-game radius to 120 meters
- adds two engine effect emitters
model = ModelData() model:setName("gentest") model:setMesh("gentest.obj") model:setTexture("gentest.png") model:setSpecular("gentest_diffuse.png") model:setIllumination("gentest_illumination.png") model:setScale(24) model:setRadius(120) model:addEngineEmitter(-13, -2.1500, 0.3, 0.2, 0.2, 1.0, 3.0) model:addEngineEmitter(-13, 2.1500, 0.3, 0.2, 0.2, 1.0, 3.0)
- adds a model named
-
Adjust the ModelData properties appropriately.
-
If you're exporting OBJ files from Blender, use the following settings:
-
If you need to rotate a model, do so from a 3D modeling program. Some example programs include:
- Blender (Windows, OS X, Linux)
- Misfit Model 3D (Windows; OS X and FreeBSD experimental)
Since model_data.lua is a Lua script file, you can use scripting tools (such as loops) to easily add many similar models.
3D coordinates (Vector3f) in these functions translate to -X, Y, Z values in Blender.
-
:setName(string name): The model's name, which is used to refer to the model in ship template scripts. -
:setMesh(string mesh_name): The relative path to the mesh file withinresources(orpacks). -
:setTexture(string texture_name): The relative path to a texture file... -
:setSpecular(string specular_texture_name): ... normal map ... -
:setIllumination(string illumination_texture_name): ... and illumination map. -
:setRenderOffset(sf::Vector3f mesh_offset): Offset the mesh's position by this amount. Useful to recenter the model if its center point in the mesh file is not at0, 0, 0. -
:setScale(float scale): Scale the mesh by this multiplier. -
:setRadius(float radius): Set the mesh's effective radius in in-game meters. -
:setCollisionBox(sf::Vector2f collision_box): -
:addBeamPosition(sf::Vector3f position): Add a visual beam emitter at this position on the model. -
:addTubePosition(sf::Vector3f position): Add a visual weapons tube at this position on the model. -
:addEngineEmitter(sf::Vector3f position, sf::Vector3f color, float scale): Add an engine emitter (visual effects trail) at this position on the model, with a RGB color (ie.1.0, 0.0, 0.0for full red), and scale.
- Home
- Building and installing the game
- Configuring the game
- Playing the game
- Officer roles and screens
- Captain
- Main screen
- Ship window
- Crews of 5-6 players
- Crews of 3-4 players
- Single-player crew
- Game Master (GM) screens
- Extra screens
- Minigames
- Weapon types
- Officer roles and screens
- Extending the game
- Troubleshooting
- Fork content
