Wierdest Thing...

Blitz3D Forums/Blitz3D Beginners Area/Wierdest Thing...

Baystep Productions(Posted 2005) [#1]
In my newest creation which is in its primitive stages. Im working on the gravity which is set to...

TranslateEntity pnt,0,-1,0

And pnt is a pivot. Which is a parent to the camera and the charecter mesh. So in my past games, when the pivot moves, the camera follows. Third-person/First. This is a third-person so the camera is translated back 150 and up 100. So, the wierdest thing happens when I execute. The pivot goes up, and the camera goes nowhere. And the EntityY(pnt) cammand printed to screen decreases. So, numericaly its going down. But graphicaly its going up (Solved by attaching a sphere as a child) and the child camera is still going nowhere based on the terrain background.


Any ideas on what I'm doing wrong???

-------------------------------------------------------

Graphics3D 640,480,32,2
AppTitle "RPG"
SetBuffer BackBuffer()
SeedRnd MilliSecs()

Const plr=1,msh=3,scn=2
Collisions plr,scn,2,1
Collisions plr,msh,1,1

Global pnt=CreatePivot()
Global light=CreateLight()
Global cam=CreateCamera(pnt)
Global mark=CreateSphere(8,pnt)
ScaleEntity mark,10,10,10
EntityColor mark,255,0,0
PositionEntity pnt,0,-100,0
EntityType pnt,plr
EntityRadius pnt,10
CameraRange cam,1,100000
PositionEntity cam,0,100,-150

Global stand=LoadAnimMesh("GFX\stand.b3d")
RotateEntity stand,0,180,0
EntityType stand,msh
HideEntity stand
Global walk=LoadAnimMesh("GFX\walk.b3d")
RotateEntity walk,0,180,0
EntityType walk,msh
HideEntity walk
Global hit=LoadAnimMesh("GFX\hit.b3d")
RotateEntity hit,0,180,0
EntityType walk,msh
HideEntity hit

Global land=LoadTerrain("GFX\land.jpg")
ScaleEntity land,1000,100000,1000
PositionEntity land,-100,-10000,-100
Global land_tex=LoadTexture("GFX\landtex.jpg")
ScaleTexture land_tex,1024,1024
Global land_trail=LoadTexture("GFX\trail.jpg",4)
ScaleTexture land_trail,1024,1024
TextureBlend land_trail,3
EntityTexture land,land_tex,0,1
EntityTexture land,land_trail,0,2
EntityType land,scn

Global guy=stand
Global walking,hiting

While Not KeyHit(1)
If KeyDown(200)
If walking=False
HideEntity guy
guy=walk
ShowEntity walk
Animate guy,1,1,0,10
EndIf
walking=True
Else If hiting=False And walking=True
Animate guy,0,1,0,10
HideEntity guy
guy=stand
ShowEntity guy
walking=False
EndIf
TranslateEntity pnt,0,1,0
PositionEntity guy,EntityX(pnt),EntityY(pnt),EntityZ(pnt)
PositionEntity cam,EntityX(pnt),EntityY(pnt)+100,EntityZ(pnt)-150
RenderWorld
UpdateWorld
Text 10,10,CountCollisions(pnt)
Text 10,20,EntityX(pnt)+","+EntityY(pnt)+","+EntityZ(pnt)
Flip
Wend
End


Baystep Productions(Posted 2005) [#2]
The lines....

PositionEntity guy,EntityX(pnt),EntityY(pnt),EntityZ(pnt)
PositionEntity cam,EntityX(pnt),EntityY(pnt)+100,EntityZ(pnt)-150

Where added in hopes of fixing it.


big10p(Posted 2005) [#3]
In my newest creation which is in its primitive stages. Im working on the gravity which is set to...

TranslateEntity pnt,0,-1,0
...but in your code it's TranslateEntity pnt,0,1,0 which is up, not down.

Also, put UpdateWorld before RenderWorld.


Damien Sturdy(Posted 2005) [#4]
I cant find the line that does your gravity.

"TranslateEntity pnt,0,1,0" is as close as i can find! Lol.


Baystep Productions(Posted 2005) [#5]
Ahhh, yes that was something I did as I was franticaly changing everything. It was just a test to see if it would change. But not to my luck. Sorry. Yes the problem happens when its -1.


Baystep Productions(Posted 2005) [#6]
This might help.....


http://www.geocities.com/amgroben/rpgerror.zip


ratking(Posted 2005) [#7]
I just tried
	MoveEntity pnt,0,-10,0
	PositionEntity guy,EntityX(pnt,1),EntityY(pnt,1),EntityZ(pnt,1)

instead of
	TranslateEntity pnt,0,-1,0
	PositionEntity guy,EntityX(pnt,1),EntityY(pnt,1),EntityZ(pnt,1)
	PositionEntity cam,EntityX(pnt,1),EntityY(pnt,1)+100,EntityZ(pnt,1)-150

and it worked for me.


Baystep Productions(Posted 2005) [#8]
collisions???


ratking(Posted 2005) [#9]
Pardon?


Shambler(Posted 2005) [#10]
Yes you will need some of those,
Collisions plr,scn,2,2

and only apply gravity if the player is not colliding with the terrain, this will help them move up hills.

Something like
If CountCollisions(pnt)=0
	TranslateEntity pnt,0,-1,0
	Else
	TranslateEntity pnt,0,1,0
EndIf



Baystep Productions(Posted 2005) [#11]
Thanks everybody. The problem has been solved!