parent bug

BlitzMax Forums/MiniB3D Module/parent bug

slenkar(Posted 2009) [#1]
if i load a ship model and parent it to a cube,
then if i create a sprite (as a bullet) and try to parent it to the model or position it relative to the model it gets messed up

as in all bullet sprites movement behave strangely, they all facce the same direction no martter what direction the ship[ is facing.

this doesnt happen when the ship is not parented to a cube


simonh(Posted 2009) [#2]
Code sample please.


slenkar(Posted 2009) [#3]
ok here you go..

http://www.mediafire.com/?ndyv1nmzjmw
I made a download just to make sure it reproduces the bug


slenkar(Posted 2009) [#4]
did you take a look yet?


simonh(Posted 2009) [#5]
Not yet, will take a look this weekend. Thanks for the sample.


simonh(Posted 2009) [#6]
I can't see any problem with that - it seems to work as I would expect it to. Commenting out the EntityParent line doesn't seem to change anything.

I need a better sample and/or description of what's going wrong exactly.


slenkar(Posted 2009) [#7]
if you play with it for a little while (turning the ship and firing bullets) youll notice that some bullets get stuck to the back of the ship, but this never happens if the line is commented out that parents the ship to the cube.

EDIT- hmm the behaviour happens even when the line is commented out, do you know why?


Robert Cummings(Posted 2009) [#8]
I see, your complaint is that perhaps the sprite view mode is out of whack when parented ? that there may be a bug where the parent is overriding sprite view behaviour? or what?


slenkar(Posted 2009) [#9]
when you shoot bullets before moving the ship they act normally,

but when you turn the ship to face backwards the bullets face toward the ship and keep moving into the ship.

(when you fire a bullet, the bullet should always be facing away from the ship obviously)

You just have to play with it for a little while to see the bullets face toward the ship.

You cant actually see what direction sprites are facing but I know they are moving into the ship because they seem to get stuck to the ship.


simonh(Posted 2009) [#10]
Really can't see the problem with this. I turn the camera, shoot the bullets, and they always move away from the ship as expected, no matter how long I fire for. Are you using the latest versions of BlitzMax (1.30) and MiniB3D (0.52)?


slenkar(Posted 2009) [#11]
yeah, I will look at the demo again to make sure,

Yep I double clicked the EXE and got some bullets to stick to the ship after 10 seconds.

Also when I move the mouse to the side the ship rolls, but according to the source code the ship is supposed to turn left and right


simonh(Posted 2009) [#12]
Here's a video of me testing it:

Video

As far as I can tell, no bullets get stuck or move in the wrong direction.

Maybe you could post a video yourself?


slenkar(Posted 2009) [#13]
thanks for taking the time to make the video

heres mine:

http://www.youtube.com/watch?v=-S1jLNAzsPU

I checked the version of minib3d and it was 0.52
i am using the SVN version of blitzmax but I dont think that makes any difference.
Im not using threads or anything non-standard
I compiled the code from the download unaltered, are you sure you didnt alter the code?

One bullet gets stuck at the start and then several get stuck at the end


Robert Cummings(Posted 2009) [#14]
"Also when I move the mouse to the side the ship rolls, but according to the source code the ship is supposed to turn left and right"

Sounds like you're not sure of your own coding ability. Do you fully understand the code yourself or are you building off existing code from somewhere else?


simonh(Posted 2009) [#15]
Well there's definitely a difference between our versions! Yes the code is unaltered - I even downloaded your zip again just to be sure.

I suspect your minib3d version may be old or modified somehow - try redownloading minib3d V0.52 again, and make sure it fully replaces the old one in your BlitzMax mod dir.


slenkar(Posted 2009) [#16]
I tried it on a different computer and got the same bug again,
after reinstalling the module.

Rob:
I just put turnentity 0,1,0 so that means it shouldnt roll

I think a global rotation is being added to the ship instead of local rotation


simonh(Posted 2009) [#17]
Compiled Exe

Can you give this a go to make sure that this is not a system issue. It should work OK.

I just put turnentity 0,1,0 so that means it shouldnt roll

I can't see that line in your sample. Are you testing the same thing as me?

TurnEntity works differently in minib3d to B3D - gimbal lock can occur.


slenkar(Posted 2009) [#18]
oh yeah I meant to say turnentity mx,my,0

roll is zero

hmm, your exe doesnt seem to do the bug


simonh(Posted 2009) [#19]
Use RotateEntity instead and it should work as expected (you'll have to increment the mx,my values yourself).

Well if you have the same MiniB3D version as me, the only thing that is different is the BlitzMax version. Could you try a standard 1.30 install? You can install it alongside your current version.


simonh(Posted 2009) [#20]
Have you tried this Jeremy? Would like to get to the bottom of this.


slenkar(Posted 2009) [#21]
ok I tried a fresh install in a different folder, fresh install of minib3d v 0.52 and it did the same error again (!) its a mystery


slenkar(Posted 2009) [#22]
does anyone else have the same issue ?


slenkar(Posted 2009) [#23]
THe problem could be caused by Tformpoint applying rotation to a matrix without using quaternions?


simonh(Posted 2009) [#24]
There is still no problem as far as I can tell. I've tested this to death now so there's no point continuing this until you can provide a solid example of a bug.