-
Senior Member
3D Game
Hello, I am making a game where you can walk in a 3D room. However, it uses hitTest and Flash won't care what you (Z) position is. How can you set the Z Position? (Not Depth, depth is just layering)
-
In your 3D room, everything should have a scale value associated with it. The smaller the scale the farther away in front of your character that object would be.
Therefore, if the vertical and horizontal scale values are roughly equal to 1 and the hitTest is true, your charater should be standing on top of the object.
-
Senior Member
-
MC._xscale, MC._yscale
I was mistaken before, an object that is at original size will have a value of 100, not 1.
-
Senior Member
Umm, xscale and yscale just change it's size, not its 3rd dimension position. Say your in the front of the room. If you jumped (and a button was in the back) it would register it as a hitTest because it looks like they hit, even though we no they are nowhere near eachother in reality.
-
skylogic.ca
You could give each object a depth value, and it either tests for hitTests if you and the object are on the same depth, or it tests for hitTests then tests to see if you and the object are on the same depth.
For example:
Code:
//(im calling it depth, but it can be anything you want, such as 'z' - it doesnt matter what you call it)
if (object1.depth==character.depth) {
if (object1.hitTest(character)) {
//Whatever it does here
}
}
And of course there's a lot more optimized ways of doing this, but i do believe this is the general idea.
~MD
-
Senior Member
Lol thanks, and then as the character is walking up it just subtracts depth?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|