Stingray Forum (Read Only)
Welcome to Autodesk’s Stingray Forums. Share your knowledge, ask questions, and explore popular Stingray topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Trigger with VR

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
540 Views, 5 Replies

Trigger with VR

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:

image.png

And this is my Flow:

image.png

 

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.

5 REPLIES 5
Message 2 of 6
Shanii2
in reply to: Anonymous

you need to attach/constraint a proxy mesh with an actor to the controller,/hmd ,having trigger /character template, and set your triggers as character trigger so that when it touches it triggers it,,..  triggers are special physics object that only fire out event if any matching template collides or passes through.

Message 3 of 6
Shanii2
in reply to: Shanii2

and considering your erros you might be having issues with selection outline, node. and that your not giving proper input to it, check your units properly where u asssigned selection outline nodes

Message 4 of 6
ThijsSchade
in reply to: Shanii2

I have the same issue. I have read the solution, but have now clue how to attach a proxy mesh to my controller.

Can anybody help me with that?

I have the HTC Vive btw, but that should not be a problem.

Message 5 of 6
Shanii2
in reply to: ThijsSchade

I believe u have'nt learnt much basics, Help docs, is ure friend for now..  ALso to parent link something to another. you have to use  Unit Link node. followed by an offset position and rotation after link node is applied..   

Message 6 of 6
ThijsSchade
in reply to: Shanii2

Dear shanii,

Thats true. I had a 3 day course from autodesk, but that is way to short to get the basics. Looking forward to the help docs, but could not found this, sorry.

But thanks for the heads up!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report