Hi!
1. I'm trying to figure out what is the best way to identify a collider object when using the physics callbacks. How do you guys do it?
A) Set the UserData attribute to store 'player.one', 'player.two', 'block.simple.22', 'block.triggered.56', etc. Then I could parse the string, and use it to identify object categories to individual objects. I have never been quite keen on parsing stings though, as it tends to be slow.
B) Use Categories as enumerated object types, e.g. PLAYER = 1, BLOCK = 2, etc. and UserData to store a number to identify the individual object, then look up the object from the list with the aid of this number, i.e. objectList[number].
C) Store the "pointer" in the UserData, and cycle through the list to identify the object.
D) ???
2. The callbacks are called at least twice, I guess it's either because when the 'player' touches a 'block' then that 'block' also touches the 'player', or simply because while resolving the penetration it's called multiple times. This means playing a sound would happen multiple times when touching the block. How do you deal with this?
3. Is it a good idea to use 'kinematic' objects for doors, moving blocks, or even to restict a player movement?
Thanks in advance!
Physics questions
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Physics questions
Not sure I fully understand what you're asking, but for 1. I would always store a "pointer" to a table of metadata (that table might also be the object it is describing) and I'd but some type information in there. Usually something like:
Code: Select all
local data = {
player=true,
blocking=false,
object=THEACTUALTHINGTHISDATAISABOUT,
}
Re: Physics questions
Yes! This is the simplest solution, and I haven't thought about it! Thanks!Ragzouken wrote:Not sure I fully understand what you're asking, but for 1. I would always store a "pointer" to a table of metadata (that table might also be the object it is describing) and I'd but some type information in there. Usually something like:
Code: Select all
local data = { player=true, blocking=false, object=THEACTUALTHINGTHISDATAISABOUT, }
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 83 guests