Disable Tweening
Blitz3D Forums/Blitz3D Programming/Disable Tweening
Is there any way to bypass tweening for some objects using Mark's Tweening code that was included with b3D demo?
because i need to 'warp' an animated character to a position without having that weird trail
you can do the movement just before captureworld. Ie, queue them up with a type, then call captureworld as normal.
As Rob says, if you call the Warp function before CaptureWorld so your mainloop looks like this (i think):
warpstuff
captureworld
updateworld
renderworld
Unless you're applying this movement to a limb(I.e one being abused by an animated entity), in which case make a record and apply it after updateworld.
odd though ive been doing that, and it didnt work
heres a segment of the code
While Not KeyHit(1)
Repeat
elapsed=MilliSecs()-time
Until elapsed
ticks=elapsed/period
tween#=Float(elapsed Mod period)/Float(period)
For k=1 To ticks
time=time+period
If k=ticks
If Warp_MHero = 1
MoveEntity mHero,0,0,-107.974
Warp_MHero = 0
EndIf
CaptureWorld
Gosub CameraControl ;Camera Movement
Gosub CharacterControl
Gosub EnvironmentControl
UpdateWorld
Gosub PostAnimationControl
EndIf
Next
RenderWorld tween#
Gosub Draw2D
Flip False
Wend
End
It's been a while so I'm a bit vague, the MoveEntity is only taking effect at UpdateWorld so..., I think this is one of those times you need to either use PositionEntity or a call to ResetEntity is needed in addition to the MoveEntity.
I think that the current tweening system definitely needs an overhaul. An entity flag that disables tweening would be a brilliant addition.
i just tried with positionentity and even resetentity, but it doesnt work :(
would there be any other work around?
I think that the current tweening system definitely needs an overhaul. An entity flag that disables tweening would be a brilliant addition.
I agree. Tweening needs a command to do for tweened entities what 'ResetEntity' does for collision entities (ie. Re-prime the entity's tween data so it behaves as though it was already at the position it has been moved to)
You could make the entity invisible for a short time.
That's still an ugly work around, though. I never could get tweening *just* right in Juno. In fact, for the menu, I enable back face culling on the gui for a frame as it fades in in order to get rid of the very nasty effects of tweening on newly created entities.
Don't use tweening. I use the delta time method for making my code framerate independent.
Don't use tweening. I use the delta time method for making my code framerate independent.
I used to use delta time in my main project but I had to switch my physics integrator from simple euler to verlet due to numerical instabilities. Due to the need for a fixed timestep for the verlet integrator, render tweening was a better fit.
Tweening is pretty good. It just comes up short of being as good as it needs to be. All it needs is a 'ResetTweenEntity/CaptureEntity' style command.
Tweening is perfect for physics. Tigerz, can you post a full example demonstrating this technique failing to work? pref with spheres as it should work.
ok sure, ill upload something in a few hours (got school in a few)
i just tried it on a sphere and theres no problem, it only happens when its on an animated (boned character) entity...
so im gonna have to find another way of doing things
I think that the current tweening system definitely needs an overhaul. An entity flag that disables tweening would be a brilliant addition.
AGREED! This happens in all my apps and no I don'#t want to use Delta Timing. Come on BRL...
I asked for this yonks ago.
Perhaps something similar to "resetentity" for tweening. :)
What's the best way to get this requested?
I would love for BRL to actually do this.
Maybe if we just keep this thread going long enough it will create a response.
I've had this problem for years....thought it was just my lousy coding techniques. :)
I seem to spend hours creating ugly work around code.
A new command to do this, would be to me, what the DDS feature was for Mustang....absolute bliss. :)
I've tried Rob's idea of calling a movement function just prior to the CaptureWorld and while this works I suppose this in itself is really just a work around.
>I would love for BRL to actually do this.
Me too.
Well,
I have emailed Blitz Support and Mark directly. I'm thinking that perhaps a DisableEntityTweening function would not be the best way to do this but to add a flag to the positioning functions to state whether tweening should be employed, so...
PositionEntity entity, x, y, z, global, disable_tween
Anyhow we shall see.
Well yes, so is the answe rto use EntityType,0, postions then reset?
Is that the best option to solve this currently?
Not exactly elagant
Nonono, i was just pointing out a thread that proves we've been after it for yonks! :)
Ah. Well the request is with Mark. We shall see.
Well?...waiting....dum de dum...sigh
COME ON BRL!
Graphics3D 800,600,32,1
Sphere1 = CreateSphere()
PositionEntity Sphere1,-3,-3,0
Sphere2 = CreateSphere()
PositionEntity Sphere2,3,3,0
Camera = CreateCamera()
PositionEntity camera,0,0,-5
light = CreateLight()
RotateEntity light,45,45,0
lr = 0
Time = MilliSecs()
CaptureWorld
PositionEntity Sphere1,3,-3,0
While Not KeyHit(1)
newtime = MilliSecs()
delta = newtime - time
tween# = delta / 2000.0
If tween > 1.0
If lr = 0
lr = 1
PositionEntity Sphere2,-5,3,0
CaptureWorld
PositionEntity Sphere1,-5,-3,0
Else
lr = 0
PositionEntity Sphere2,5,3,0
CaptureWorld
PositionEntity sphere1,5,-3,0
End If
time = newtime
tween = 0
End If
RenderWorld tween
Text 10,10,tween
Flip
Wend
Top sphere warps, bottom sphere tweens.
Cool BUT Marks render tweening code is structured like this...
While g_main_state = MAIN_STATE_GAME
Starttime = MilliSecs()
Repeat
elapsed=MilliSecs()-frametime
Until elapsed
ticks=elapsed / period
tween=Float(elapsed Mod period)/Float(period)
For i=1 To ticks
frametime=frametime+period
If i=ticks Then
CaptureWorld
End If
game_update()
UpdateWorld
Next
RenderWorld tween
Flip
Wend
notice the placement of the update_game routine.
Using your technique you would have to move the update to just prior to the capture. Not so good!