Problems with Ray Diaz's Beginners Tutorials

Blitz3D Forums/Blitz3D Beginners Area/Problems with Ray Diaz's Beginners Tutorials

Happy Sammy(Posted 2005) [#1]
Hi all,

I follow the 3d tutorial -Tutorial 3- battle003. (The following media files also come from that tutorial)
My test files could be downloaded here!



Questions:
-------------
1. When I run the program, I STILL could pass through wall of house, even I have set the collisons command.
(Collisions PLAYER, PROPS, 2,1). Why? (I tried to run the sample program provided and still could pass through wall!!!)

2. According to the tutorial,
terra_y# = TerrainY(terrain,x#,y#,z#)+1.6
PositionEntity camera_pivot,x#,terra_y#,z#
MUST be after "UpdateWorld" command.
However, according to B3d Manual, "UpdateWorld" is used for collision checking.
So, I tried to move these 2 statements before "UpdateWorld" command as follows:



Ok. I could be blocked by the wall of house this time!! However, my starting position was changed too! Why?
(New position: x= 0, y=6.5, z=2.38.
It should have been: x= 10, y=5.6, z=120
because "PositionEntity camera_pivot,10,5.6,120")

I am using update v.191. Any ideas?

Thanks in advance
Sammy
:)


jhocking(Posted 2005) [#2]
I haven't looked at the code, but I'm guessing the reason the starting position is off is because of collision detection. Make sure to move to the starting position before calling the collisions command.


Baystep Productions(Posted 2005) [#3]
Yup, I use set collisons, then create entities, then move them, then set type. Like so..

camera_pivot = CreatePivot()
PositionEntity camera_pivot,10,5.6,120
EntityRadius camera_pivot,1.4
EntityType camera_pivot, PLAYER



Happy Sammy(Posted 2005) [#4]
Hi jhocking and PCD GUY,

I try to move "Collisions" command to the very beginning of the program and this does not help.

Thanks
Sammy
:)


ervin(Posted 2005) [#5]
Hi Sammy.
I've had similar troubles with the tutorial in the last few days, but I've managed to get past this problem...

I've got the collisions commands right before the game loop:
Collisions CARPET,SCENERY,2,1
Collisions PLAYER,PROPS,2,1

While Not KeyHit(1)
...
Wend

I have camera_pivot set up like this:
EntityRadius cameraPivot,1.4
EntityType cameraPivot,player
PositionEntity cameraPivot,0,5.6,120

I have floor1 set up like this:
EntityRadius floor1,.4
EntityTexture floor1,cube_tile
EntityType floor1,CARPET
PositionEntity floor1, 10,6,120
ScaleEntity floor1,8,0.06,13
ScaleTexture cube_tile,.5,.5

The kitchen is setup up like this:
EntityRadius kit, 1.1
EntityTexture kit,kit_tex
PositionEntity kit,10,6.5,128
ScaleEntity kit,0.08,0.08,0.08
EntityType kit,PROPS

And the shop like so:
EntityRadius TTshoppe, 1.1
EntityTexture TTshoppe,TTshoppe_tex
PositionEntity TTshoppe,10,6.5,112
RotateEntity TTshoppe,0,180,0
ScaleEntity TTshoppe,0.08,0.08,0.08
EntityType TTshoppe,PROPS

You'll notice that for the kitchen and shop, I've put EntityType after PositionEntity.
If you put EntityType before PositionEntity, the z coordinate of camera_pivot changes to 2.28102!

This is really strange. If anyone has an explanation for this, I'd be really interested to find out why this happens.

Anyway, put EntityType after PositionEntity, and that'll hopefully take care of the problem.


Happy Sammy(Posted 2005) [#6]
Hi ervin,

Yes, you are absolutely right!!!
I tried your method and the coordinates are correct.
Also, if we change codes to
....
x# = EntityX(camera_pivot)
y# = EntityY(camera_pivot)
z# = EntityZ(camera_pivot)
terra_y# = TerrainY(terrain,x#,y#,z#)+1.6
PositionEntity camera_pivot,x#,terra_y#,z#
touchGround(floor1)
touchGround(floor2)
touchGround(floor3)
touchGround(floor4)
TurnEntity nacar,0.5,0.5,0
UpdateWorld
RenderWorld
....

we could successfully be blocked by the houses and not go through them!

Moreover, I find that the starting position is also very important.
PositionEntity camera_pivot, x, 6.5, 120

1. If x = 2, the starting coordinates are reasonable. camera_pivot is seperated from shop.3ds or other buildings.
2. If x = 10, the starting coordinates are unreasonable. The reason I think: the camera_pivot ALREADY collided with shop.3ds (with EntityRadius overlap!)and this is also related to EntityRadius of shop.3ds and camera_pivot!
(You could tried other values of EntityPosition of camera_pivot. I think these kind of problems could be avoided if tool like "World Assembler" was used as objects are placed visually.)

In battle004.bb, these 2 problems affect the starting coordinates and collisions again.
1. "Floor1": EntityType should after PositionEntity
2. PositionEntity camera_pivot,x,z,y

Now, I could move on to other tutorials...

Thanks a lot.
Sammy
:)


ervin(Posted 2005) [#7]
Glad I could help.

Yes, it seems that if your starting position is inside something you can collide with, it throws your start position off.


WolRon(Posted 2005) [#8]
Looks like all of you guys are overlooking the ResetEntity command.

Just use it after invoking your movement commands (regardless of whether collisions are turned on or not) and you enitities won't be hampered by (run into) the game objects.