Memory Access Vialation =.P

Blitz3D Forums/Blitz3D Programming/Memory Access Vialation =.P

AvestheFox(Posted 2004) [#1]
everytime I try to set a rotatemesh on my md2 model, it gives me that error.... here's my code:

------------------------------------
Graphics3D 640,480,16,2
SetBuffer BackBuffer()

camera=CreateCamera()

light=CreateLight()
RotateEntity light,90,0,0

bob=LoadMD2( "bob.md2" )

PositionEntity bob,0,-5,50
RotateMesh bob,0,90,0

While Not KeyDown( 1 )

;movement

If KeyDown(200) Then
MoveEntity bob,0,0,1
EndIf

If KeyDown(208) Then
MoveEntity bob,0,0,-1
EndIf

If KeyDown(203) Then
TurnEntity bob,0,1.0,0
EndIf

If KeyDown(205) Then
TurnEntity bob,0,-1.0,0
EndIf

;animation

If Not KeyDown(200) Then
AnimateMD2 bob,1,0.5,9,1
EndIf


UpdateWorld
RenderWorld
Flip

Wend

End
---------------------------------------

Basicly, I'm experimenting with animated meshs, trying to make Bob look like he's walking, problem being, his mesh is turned sideways, and he kinda looks wierd going sideways while apearing to walk foward in his animation... that's why I need the rotatemesh command


Shambler(Posted 2004) [#2]
Insert after bob=LoadMD2("bob.md2")

If bob=0 Then RuntimeError "Failed to load bob!"

This will tell you if bob is being loaded or not.


AvestheFox(Posted 2004) [#3]
hmmm.. still giving me an error.... I've tried plaving the code several other places as well, but it just keeps on giving me that same error =P

Think it may just be my computer


Floyd(Posted 2004) [#4]
Turn Debug on.


AvestheFox(Posted 2004) [#5]
okay, diferent error this time.. which is kinda wierd...

"Entity is not a Mesh"


John Blackledge(Posted 2004) [#6]
MD2s are not considered to be meshes by Blitz, but _are_ entities. Try RotateEntity().


AvestheFox(Posted 2004) [#7]
well, that's the thing... I'm really trying to rotate the model itself, not the entity... in other words, by rotating the entity, it does nothing but rotate's the model's movement and everything else.

Bob moves sideways instead of foward... my model is facing the wrong direction.... MS3D wont let me change that for some odd reason.... but maybe I could cheat the code, and use the sidestep code to make Bob look like he's going foward, and not side stepping


Paolo(Posted 2004) [#8]
@Aves_Fox,
when you move characters or whatever in your scene, it is always better you don't use the model itself because of the problem you are getting now, you never know exactly "how" your model is going to be loaded into Blitz after the export process...

So what you have to do is to program all the movement stuff in a PIVOT, and then parent to that pivot all the visuals related, that way then you can RotateEntity(), PositionEntity(),...., all related to its parent so you don't have to worry about it...

Paolo.


John Blackledge(Posted 2004) [#9]
Spot on, Paulo.