Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

HTC Vive Template Door Open/Close trigger with Unit Flow not working

Anonymous

HTC Vive Template Door Open/Close trigger with Unit Flow not working

Anonymous
Not applicable

I can't seem to get a two clip door open/close animation to work with the HTC Vive and a trigger. The two aluminum doors swing outward on one clip and inward on the other. The panel on the left of the frame has two halves (a top and a bottom). One trigger (misnamed collision) box covers the top and another covers the bottom. In the last image I have made these two meshes visible. But, when I run everything both boxes are set to invisible and not cast shadows.

 

Please note that the trigger meshes are incorrectly named by me "Collision_Open" and "Collision_Closed". 

 

I have tried the different types shape templates for these two objects, and I can't get any shape template to work.

 

 

 

The animation clips play correctly in the asset preview window.

Thank you for your help.

 

Door Actors.JPGTrigger Actors.JPGTrigger Meshes.JPG

Unit Flow.JPG

Trigger mesh visible.JPG

log.JPG

Also, if you know how I can get rid of the warning that states "Test Engine / ResourcePackage: Failed loading unit named content/models/City-Aura/S_Platform_White" then I would appreciate that too. I don't have that unit in any of the folders or the explorer. I deleted it, but and now it is showing that warning.

Reply
Reply
0 Likes
Reply
1,226 Views
9 Replies
Replies (9)

paul.kind
Alumni
Alumni

So, i am interested.  if you connect the garage door animations to something like a spacebar press.  will it work?

 

In vr, we don not have an actual "character" so what you would need to do is teleport the character wherever the headset is if you want to do it the way i think you are trying to do it.  Basically in VR when you move, there is nothing to collide with.

 

Paul

 

Areas of Expertise - MayaLT : Mudbox : 3DS Max : Inventor : Game Dev
Follow me on Twitter : @paulkind3d

Please remember to give kudos freely and mark acceptable answers as solved!

PLEASE do not send me private messages unless asked to do so. If you have a question, start a thread, and ask me on the public forums where answering your question may help others.

Did you know there was a YouTube learning channel for Autodesk Games? New videos are posted regularly with all sorts of content relative to Stingray, Maya/MayaLT, 3DS Max, and other game related tools. Get your game on @ https://www.youtube.com/user/autodeskgameshowtos
Reply
Reply
0 Likes

Anonymous
Not applicable

Your insight is correct. If I connect the animation to a press of the keyboard it does not work. But, the animation does play in the clip editor when I hit play. The animation was created in Max and exported via the game engine exporter.

Spacebar Animation Play.JPG

Reply
Reply
0 Likes

Anonymous
Not applicable

Also, is teleporting the character the best way. I just want to trigger the animation when the controller enters the trigger space?

Reply
Reply
0 Likes

Anonymous
Not applicable

Ok, I redid the animation in 3ds Max, and this time I made sure that everything was associated with the same multi-sub object material. The animation now works with the space bar. I presume that that was the issue with the animation not working in the scene, but working in the asset preview.

 

I have also been able to get it to work with a large collision box, such that the character collides with the box and plays the animation. I did the following to get that to work:

In steam_vr.lua, around line 70 or so, after "--Create VR Controllers" bits of lua, add this:

-- spawn collision for hmd and attach to hmd -- for use in triggers as a "character"
	self.hmd_collision = World.spawn_unit(self._world, "vr_steam/models/hmd/hmd_char_collision", pose)
	SteamVR.link_node_to_tracker(self.hmd_collision, 1, self._world, SteamVR.LINK_HMD)

 

But, my former unit flow logic still does now work. What I want is for the vive controller to enter the trigger (collision space) on the panel and play the animation. I can't get that to work. Any ideas on that specifically. I want to move the vive controller in the trigger/collision space (a mesh just outside the panel) and have it play the animation. Is this possible?

Reply
Reply
0 Likes

paul.kind
Alumni
Alumni

Yes, I will reply again tomorrow with more specifics (super late and heading to bed).

 

The theory here is that you will want to create a collision mesh on the controllers (if one does not already exist) and then on your collision meshes, set up the physics file to trigger when the door is touched by a controller.

 

The physics file is located in your root directory of your project.  global.physics_properties

 

In there you can create specific filters where it will allow you to trigger the volume.  If you can wait till morning ill try and get a test done that would allow this type interaction, otherwise feel free to dig into it yourself.  You set these properties (once created) in the unit editor.

 

more infor on global physics : http://help.autodesk.com/view/Stingray/ENU/?guid=__stingray_help_creating_gameplay_physics_global_ph...

 

Paul

 

Areas of Expertise - MayaLT : Mudbox : 3DS Max : Inventor : Game Dev
Follow me on Twitter : @paulkind3d

Please remember to give kudos freely and mark acceptable answers as solved!

PLEASE do not send me private messages unless asked to do so. If you have a question, start a thread, and ask me on the public forums where answering your question may help others.

Did you know there was a YouTube learning channel for Autodesk Games? New videos are posted regularly with all sorts of content relative to Stingray, Maya/MayaLT, 3DS Max, and other game related tools. Get your game on @ https://www.youtube.com/user/autodeskgameshowtos
Reply
Reply
0 Likes

Anonymous
Not applicable

I have tried working with the global.physics_properties file to no avail. I have made my file exactly like the file for the VR_Vive_Museaum_Example project.

 

I must be doing something wrong with my animations also, or stingray has an odd way of handling them. I have attached a fairly simple fbx animation file to this post. The animation plays perfectly in the asset preview, and in Max, but again it doesn't play in the scene with collision, nor does it play with a keyboard/mouse press.

 

I have setup the properties for the physics actors correctly, and double/triple checked (keyframed is correct, mesh and box settings are correct, and character trigger is correct).

 

I don't understand why this simple animation is working in the asset preview, but doesn't work in the scene. And, when I can get other animations to work with a mouse or keyboard press, they sometimes don't work with a physics trigger. I spent hours yesterday testing and re-testing, and still couldn't get things to work as they should.

 

 

Reply
Reply
0 Likes

paul.kind
Alumni
Alumni

So dealing with the global physics file is certainly no easy task.  It is a bit confusing.  I will try and explain how it works.  You can often tinker till things work, but if you are like me, you want to know exactly how and why things do what.

 

So, here goes.

1. Collision Types are simply definitions.  Think of them as a reference.

2. Filters : Explain how an object interacts with other objects.  For example if we have bat ={is=["bat"] collides_with = ["ball"] } and we apply this filter to a bat, it will ONLY collide with a ball.

3. Shapes : This area is where we define our bat.  THis part is fairly straight forward excepting sweep and triggers. 

With sweep we can tell the physics simulation to test between frames for physics collisions.  This is VERY intensive though, so unless you need it, try avoiding it.  Basically you want to use this for high velocity, small objects (like bullets for example). 

example:  A bullet is traveling 3 meters per frame.  You wall is 1/2 meter thick.  If on one frame it is 1 meter in front of the wall and the next frame it is 2 meters behind the wall the physics engine would not register a collision.  It would pass through the wall like it was not there.  In a case like this, sweep would be used where it would test to see if it ever intersected the wall even between frames.

Wit Trigger : Triggers are pretty obvious too for the most part, but one thing is very tricky with them.  Because it is logical to think that a trigger triggers something.  In actuallity it is the other way around.  Triggers are volumes that trigger  The volume must be tested.

 

Practical example.

Lets say we have a vr player with a bat.  Behind the player is a collision.  and we have a pitcher that throws a ball.

 

filter definitions.

bat ={is=["bat"] collides_with = ["ball"] }

ball = {is=["ball"] collides_with_all_except[""]

strike_volume = {is=["strike_volume"] collides_with["ball"]

 

So, the bat collides with a ball.  a ball collides with everything.  and the strike_volume collides with the ball.

 

Now for the shapes, we need to do this.

bat = {sweep="true" collision_filter="bat"}

ball = {sweep="true" collision_filter="ball"}

strike_volume = {trigger="true" collision_filter="strike_volume"}

 

This will bind the filters to the shapes and define the way they actually act.  Now here is the important bit as far as the trigger is concerned.  The strike_volume is triggered by the ball.  If you test the ball to see if the it has been triggered, it will not reply!  ONLY the strike_volume can be tested and produce a reply!!! Once you get that bit, i think you will have an easier time.  It had me stumped for a while and caused a lot of confusion till i understood this. 

 

Anyhow, ill go ahead and see if I can setup a small project in a little bit to help demonstrate how to do what you are trying to do.

 

Paul

 

 

 

Areas of Expertise - MayaLT : Mudbox : 3DS Max : Inventor : Game Dev
Follow me on Twitter : @paulkind3d

Please remember to give kudos freely and mark acceptable answers as solved!

PLEASE do not send me private messages unless asked to do so. If you have a question, start a thread, and ask me on the public forums where answering your question may help others.

Did you know there was a YouTube learning channel for Autodesk Games? New videos are posted regularly with all sorts of content relative to Stingray, Maya/MayaLT, 3DS Max, and other game related tools. Get your game on @ https://www.youtube.com/user/autodeskgameshowtos
Reply
Reply

Anonymous
Not applicable

Thank you for the explanation of how the global physics file works. I will likely need this in the future, although I must admit that I was playing around with it and was only breaking things.

 

I did eventually get the collision to work without having to modify the physics file. It would be good to know how to actually do this with the physics file, but that can be a later lesson.

 

In order to get the collision to work I did the following:

The collision meshes (set to Type: Box) are set to the Shape Template "trigger".

Animation-CollisionPanelTrigger_UnitEditorViewport.JPGAnimation-CollisionPanelTrigger_Controller.JPGAnimation-CollisionPanelTrigger_UnitEditorFlow.JPG

I did not have to change the global.physics_properties file:

materials = {
	default 			= {density = 1, dynamic_friction = 0.1, static_friction = 0.1, restitution = 0.1, restitution_combine_mode = "max"}
	bounce 				= {density = 1, dynamic_friction = 0.01, static_friction = 0.1, restitution = 1.0, restitution_combine_mode = "max"}
}

collision_types = [
	"default"
	"character"
	"congas_trigger"
	"pickup_trigger"
	"static_object"
	"turn_object"
	"turn_off_trigger"
]

collision_filters = {
	default 			= {is = ["default"] collides_with_all_except = ["character"]}
	static_object 		= {is = ["static_object"] collides_with_all_except = ["pickup_trigger"]}
	character 			= {is = ["character"] collides_with_all_except = ["pickup_trigger"]}
	character_trigger 	= {collides_with = ["character"]}
	turn_off_trigger	= {collides_with = ["turn_object"]}
	congas_trigger		= {collides_with = ["static_object"]}
	turn_object			= {is = ["turn_object"] collides_with = ["turn_off_trigger"]}
	pickup_trigger 		= {collides_with_all_except = ["static_object"]}
	non_collider 		= {is = [] collides_with = []}
}

shapes = {
	default 			= {}
	trigger 			= {trigger = true}
	sweeper 			= {sweep = true}
	character 			= {collision_filter = "character"}
	character_trigger 	= {trigger = true collision_filter = "character_trigger"}
	congas_trigger		= {trigger = true collision_filter = "congas_trigger"}
	pickup_trigger 		= {trigger = true collision_filter = "pickup_trigger"}
	static_object 		= {collision_filter = "static_object"}
	turn_off_trigger	= {trigger = true collision_filter = "turn_off_trigger"}
	turn_object			= {collision_filter = "turn_object"}
}

actors = {
	static 				= {dynamic = false}
	dynamic 			= {dynamic = true linear_damping = 0.01 angular_damping = 0.01}
	keyframed 			= {dynamic = true  kinematic = true linear_damping = 0.05 angular_damping = 0.05}
}

I made another door that slides open when the character (connected to the HMD per the code in my earlier post) enters a collision space. I think it is important to point out for others that when Unit properties are set to Type: Box (instead of Mesh), that it really is a box. I setup a cuboid for the collision (see image below, and then kept wondering why the collision wasn't working on the outer part of the cuboid, which in my mind, I was thinking was a box (although I know it is not).

Hence, the collision on my cuboid is in Red...just remember that even though you may setup a cuboid, it is not a box, and the collision will only work on the box Stingray creates out of the mesh.

Animation-CollisionBox-Door-Visible-Viewport.JPG

Reply
Reply
0 Likes

Anonymous
Not applicable

I also got it to work this way, but the animation jumps between clips and the flow here is likely not optimal or even correct:

Animation-CollisionBox-Door.JPG

Reply
Reply
0 Likes