Strange behavior with animated Tree

Blitz3D Forums/Blitz3D Programming/Strange behavior with animated Tree

RifRaf(Posted 2012) [#1]
see this file for complete example code and b3d file.
http://www.empowergames.com/viewtree.zip

This tree I created with Tree[D] cannot be positioned or moved if its animating. Now most of my projects havent involved any animated media so this is new to me.

If I dont animate it, I can move it or position it wherever I want to, after calling Animate .. the positioning calls do not work on it.

Thanks in advance, this is not a pressing matter at the moment ive just been tinkering with the tree[D] tool and thought this was weird.

Last edited 2012


Matty(Posted 2012) [#2]
Hi, I think this problem has come up before but as I'm on my phone I can't link to it. However the solution is to parent the tree to a pivot and move the pivot.


RifRaf(Posted 2012) [#3]
Thanks Matty, I guess ill just do that.


Ross C(Posted 2012) [#4]
Is it a boned animation?


Guy Fawkes(Posted 2012) [#5]
Try this to see better:





Keys: A/Z: Fly up/down,
W/A/S/D OR ArrowKeys: Turn left/right Move forward/backward


EDIT:


And try THIS for speed addition:




Last edited 2012


Ross C(Posted 2012) [#6]
?


Guy Fawkes(Posted 2012) [#7]
Lol, I don't like laggy things :3


Ross C(Posted 2012) [#8]
Ok, updateworld seems to be causing the jump back. You will need to give each tree x,y,z variables and move the tree after the updateworld:

Press the 1 key to start/restart the animation.

Graphics3D 1024,764,0,2

SeedRnd MilliSecs()

cam=CreateCamera()
Global tree=LoadAnimMesh("mypine1.b3d")
PositionEntity cam,0,40,100
PointEntity cam,tree

For i=1 To 5
	cc=CopyEntity(tree)
	PositionEntity cc,Rand(-50,50),0,Rand(-50,50)
	;Animate cc,1,1
    TurnEntity cc,0,Rand(0,180),0 
    ScaleEntity cc,1,Rnd(.65,1.5),1
Next

HideEntity tree

Global cc_x#
Global cc_y#
Global cc_z#

While Not KeyDown(1)
	

	If KeyHit(2) Then
		Animate cc,1,1
	End If

	UpdateWorld()

	If MouseDown(1) Then
		cc_z = cc_z + 1
	End If

	PositionEntity cc,cc_x,cc_y,cc_z

	RenderWorld()
	Flip
Wend


There must be something in the .b3d animation that resets the position of the entity. It resets the rotation and scale as well, so you'll need to set everything like that as well.

Last edited 2012


Guy Fawkes(Posted 2012) [#9]
I made it pretty :3 The only thing not pretty about it, is the mess up in the gravity for the camera... Sorry about that :3




Last edited 2012


Guy Fawkes(Posted 2012) [#10]
And here it is with an option to click on a tree, select it, move it with the Q key, and unselecting it by clicking it, or clicking on another object, or clicking somewhere in the background :3





Im sorry, I couldn't resist :3

Last edited 2012


Guy Fawkes(Posted 2012) [#11]
Here's the last part of the code MINUS loading... For SOME reason, I can't get it to save EACH tree & it's coordinates + id to a file... Instead, it's saving the FIRST object's ID, and I can't get it to save all 51 trees IDs to the file ><


Maybe u guys can fix it and tell me why & how this save function isnt working right? ><





Ross C(Posted 2012) [#12]
You can't hi-jack someones thread with code help for yourself, when your code you posted doesn't help the original person with their own code.


Guy Fawkes(Posted 2012) [#13]
w/e


Yasha(Posted 2012) [#14]
w/e


Can't you just go back to the racism, swearing and shouting?

Because even that was less annoying than rendering the help areas completely unusable for other people, you inconsiderate sod.


Guy Fawkes(Posted 2012) [#15]
No


Captain Wicker (crazy hillbilly)(Posted 2012) [#16]
Thundros = puki?

EDIT:
Very Strange how trees continue to create lag in games but after my own problem a while back, The other day I had rewritten my own game in darkbasic and imposters and solved my problem after a couple of weeks. I had noticed in the second code posted earlier by Thundros that the trees can cause serious lag in your program. I suggest using something like imposters (for blitz) that can render grouped meshes as 2d quads to improve game fps. :)
http://www.thegamecreators.com/?m=view_product&id=2293

Last edited 2012


Rob the Great(Posted 2012) [#17]
Reading Yasha's post, I didn't understand what was going on. Then I read mac_n00bie's, and I was even more confused. I had to read over old topics to finally figure out what was going on.

Rez, when did your name become Thundros?! And an even better question, how did your online personality appear to change more than your name?


Guy Fawkes(Posted 2012) [#18]
I just don't take it to heart anymore :) And I change my name because I like changing my name :) I hate being one person for so long :)