The minigame has elements:
- object movement. Done by `HYP_PhysX.AddSphereActorToScene`
- laser effect with `HYP_Primitive.CreateLine`
- sound effect
- and if there is target a particle effect on hit position
Particle effect is working as expected, could not find doc about it in api reference.
Laser effect is not working. `HYP_Primitive.CreateLine` does return valid id (id > 0) but is not rendered, here is code :
line = HYP_Primitive.CreateLine('dzebana')
log('laser created : '.. line)
HYP_Primitive.SetLineVertexPosition(line, 0, pos.x, pos.y, pos.z)
HYP_Primitive.SetLineVertexPosition(line, 1, target.x, target.y, target.z)
HYP_Primitive.SetLineVertexColor(line, 0, 1, 0, 0, 0.7)
HYP_Primitive.SetLineVertexColor(line, 1, 1, 0, 0, 0.7)
For every sound effect (when ship fires you can hear 'zaap') I use load so user can hear effects overlapping :
local effect = HYP_Sound.Load('data/sound/zap.wav', 0)
HYP_Sound.SetSourcePosition(effect, pos.x, pos.y, pos.z)
I do not know whether to always create a new sound.
For collision detection I use `HYP_Scene.CastRay`. To better the detection model has sort of bounding box around it, with material that has alpha == 0 and white color. Somehow that material is not loaded properly or was lost during export from google sketchup to 3ds.
Maybe if I add boundingbox mesh manualy to model and set its material in script ..
Ideally, I would calculate collision with physix actors but I didn`t found the way to do it.
I like to define model in xml and then use it as template for instancing objects with the same model. In this case clone function comes handy. And I don`t know if it is good to use `HYP_Model.Load`every time when new element is inserted in scene.
Also there is another model far to the right but is not visible somehow.