I have been trying to work out collision detection for sprites and got some help from DJ but must admit I didn't really understand.
So,I've been doing the following.As an example for a tree I will create a cone,sphere,cylinder,whatever. with alpha 0.
TRY to get it to lineup in the center of the sprite.Shouldn't be hard - wrong.
Relevent code:
pinetree=CreateCone(4)
pinetrunk=CreateCube()
ScaleEntity pinetree,25,25,25
ScaleEntity pinetrunk,2,10,2
EntityType pinetree,type_ground
EntityType pinetrunk,type_ground
RotateEntity pinetree,0,45,0
PositionEntity pinetree,40,38,-460
PositionEntity pinetrunk,40,5,-460
EntityAlpha pinetree,0
EntityAlpha pinetrunk,0
EntityParent pinetree,pinetrunk
trees=CreateSprite()
EntityTexture trees,arb
ScaleSprite trees,32,32
EntityAlpha trees,1
EntityType trees,type_ground
PositionEntity trees,40,15,-460
EntityParent trees,pinetrunk
The combined "tree" will not center with the sprite.
I've worked on this for hours off and on.Tried everything.
The scale,the order of entry,using move rather than position and nothing worked.Then BINGO.
The messup came from EntityType pinetree,type_ground.
Changing the type makes no difference,the same command in the other two cases works ok,the parent part of the deal makes no difference.
So what the heck is this all about. Is there a bug I don't know about?
Be interested in any thoughts.
So,I've been doing the following.As an example for a tree I will create a cone,sphere,cylinder,whatever. with alpha 0.
TRY to get it to lineup in the center of the sprite.Shouldn't be hard - wrong.
Relevent code:
pinetree=CreateCone(4)
pinetrunk=CreateCube()
ScaleEntity pinetree,25,25,25
ScaleEntity pinetrunk,2,10,2
EntityType pinetree,type_ground
EntityType pinetrunk,type_ground
RotateEntity pinetree,0,45,0
PositionEntity pinetree,40,38,-460
PositionEntity pinetrunk,40,5,-460
EntityAlpha pinetree,0
EntityAlpha pinetrunk,0
EntityParent pinetree,pinetrunk
trees=CreateSprite()
EntityTexture trees,arb
ScaleSprite trees,32,32
EntityAlpha trees,1
EntityType trees,type_ground
PositionEntity trees,40,15,-460
EntityParent trees,pinetrunk
The combined "tree" will not center with the sprite.
I've worked on this for hours off and on.Tried everything.
The scale,the order of entry,using move rather than position and nothing worked.Then BINGO.
The messup came from EntityType pinetree,type_ground.
Changing the type makes no difference,the same command in the other two cases works ok,the parent part of the deal makes no difference.
So what the heck is this all about. Is there a bug I don't know about?
Be interested in any thoughts.