Findout out what object the player has collided with
by arteria3d · in Torque Game Engine · 02/05/2005 (4:16 pm) · 6 replies
As i am using lots of objects in my game, not loaded as part of a script, i wish to add 'foilage sounds' to the object when the player passes through. This can be done in script using on:collision - but as i say, the object isnt loaded via script.
What command, or 'test' would determine if the player was on a particular object.
COuld anybody be kind enough to help me about please?
What command, or 'test' would determine if the player was on a particular object.
COuld anybody be kind enough to help me about please?
About the author
Owner of uk based Ltd company ArteriaMediaLtd. with a trading name of Arteria3d Website;arteria3d.com
#2
But I'm not sure how it will respond in case the folliage is created thru a replication method or if the folliage hasn't a bounding box. If you CAN pass thru it, then no collision should be detected. And even if you would detect it, maybe you shouldn't cause it will mean a great deal of events to be processed.
My 2 cents on how to solve this would be changing the player default moving sound if he is in the area that the folliage is located. You could do that by adding just 1 trigger.
02/06/2005 (5:56 am)
The parameter "%obj" of the OnCollision() method will give you the id of the object you collided with. You can test what kind of object that was using %obj.classBut I'm not sure how it will respond in case the folliage is created thru a replication method or if the folliage hasn't a bounding box. If you CAN pass thru it, then no collision should be detected. And even if you would detect it, maybe you shouldn't cause it will mean a great deal of events to be processed.
My 2 cents on how to solve this would be changing the player default moving sound if he is in the area that the folliage is located. You could do that by adding just 1 trigger.
#3
02/06/2005 (6:23 am)
Only grow grass on one type of terrain texture. If you need it only on part of the texture, then make 2 the same, but with different names. Then you can add the sound to the material mapping.
#4
02/06/2005 (6:51 am)
Thanks Eric - funny enough i jus had the same brainstorming idea!!!! - cheers bud
#5
How would i use the on:collision command to determine this. I know how to use it when worked from a script to load the object in, but most of the objects i need to have a sound attached to, are not loaded via script.
And.. would the script to do this, then become part of player.cs or be a different script altogether
02/06/2005 (10:49 am)
I have used the terrain texture method, using a few different instances of the same texture named differnt, but i need more closer in detail.How would i use the on:collision command to determine this. I know how to use it when worked from a script to load the object in, but most of the objects i need to have a sound attached to, are not loaded via script.
And.. would the script to do this, then become part of player.cs or be a different script altogether
#6
TSE has however, changed much of that. Lots of these little things will be an easier job now.
02/06/2005 (4:11 pm)
I really don't think its possible. A few years ago, I had the idea of using collisions and textures to do all sorts of things, similar to the flags Quake1 had. I eventually decided it was semi-close to impossible with the current system.TSE has however, changed much of that. Lots of these little things will be an easier job now.
Associate Anthony Rosenbaum