Message 1 of 6
Trigger with VR
Not applicable
11-21-2018
09:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi guys,
I need to play/stop an animation when i touch the trigger with Oculus Touch controller or just touch the trigger.
I really don't know code at all, sp, i try to do my best to archive that, but still have some issues:
That is my trigger:
And this is my Flow:
I'm using Oculus Rift with toutch controller to play around in the scene, my animation Works fine, the problem is, when i toutch the trigger, my screen freeze and I receive this error message:
localhost / Lua: [string "..."]:68: Accessing a deleted unit.
Error Context
----------------------------------------
Flow callback:
local Unit = stingray.Unit
local Matrix4x4 = stingray.Matrix4x4
local Quaternion = stingray.Quaternion
local Vector3 = stingray.Vector3
local Color = stingray.Color
local Vector4 = stingray.Vector4
local Material = stingray.Material
local Mesh = stingray.Mesh
local _selection_mask_counter = 0
local function get_mesh_by_name_or_all(unit, mesh_name)
local meshes = {}
if mesh_name and Unit.has_mesh(unit, mesh_name) then
table.insert(meshes, Unit.mesh(unit, mesh_name))
elseif mesh_name == nil or mesh_name == "" then
local num_meshes = Unit.num_meshes(unit)
for i=1, num_meshes do
local mesh = Unit.mesh(unit, i)
table.insert(meshes, mesh)
end
end
[...]
)
return
end
for j=1, #materials do
_match_found = true
local material = materials[j]
Material.set_vector4(material, "dev_selection_color", color)
-- Material.set_color(material, "dev_selection_color", color)
Material.set_scalar(material, "dev_selection_mask", (_selection_mask/255))
Material.set_shader_pass_flag(material, "dev_selection", value)
end
end
if not _match_found then
print_warning("Warning: setUnitHighlight: No material slot found for "..Unit.debug_name(unit).." named "..tostring(t.MaterialSlot))
end
end
end
return setUnitHighlight
Lua Callstack
----------------------------------------
[1] [C]: in function has_data
[2] [string "..."]:68:in function <[string "..."]:41>
[3] [C]: in function update
[4] core/appkit/lua/world_wrapper.lua:84: in function update
[5] core/appkit/lua/app.lua:257: in function update
[6] core/appkit/lua/simple_project.lua:381:in function
Lua Locals
----------------------------------------
[2] t = table: 000000007ECAB368, _selection_mask = 6, input_color = Vector3(67, 255, 163), alpha = 1, unit = [Unit (deleted)], value = true, color = Vector4(0.262745112, 1, 0.639215708, 0.xxx-xxxxxxxx)
[4] self = table: 000000007ECCC6A0, dt = 0.022154655307531357, world = [World]
[5] dt = 0.022154655307531357, managed = table: 000000007ECCDB78, managed_world = table: 000000007ECCC6A0
[6] dt = 0.022154655307531357
I really don't know what i need to do to fix that.
When i touch the trigger, with Oculus Toutch, my animations needs to stop, and when I move my hands out of the trigger, my animation needs to resume.
If anyone have something to help me, thanks.
Reply
Reply