Blending 'PointEntity'?

Blitz3D Forums/Blitz3D Beginners Area/Blending 'PointEntity'?

Dock(Posted 2005) [#1]
Can anyone think of any way to blend in 'PointEntity' over a number of frames, so that it doesn't 'click' immediately to the new position? I want the character to turn to face, but not snap to face the new direction.


Stevie G(Posted 2005) [#2]
Something like this should do the job ... where the rate# is between 0.0 and 1.0.


Function EntityPoint( Source , Target, Rate# )

  dy# = deltayaw( Source , Target ) * Rate
  dp# = deltapitch( Source , Target ) * Rate
  turnentity Source , dp , dy , 0

end function



You could also use aligntovector on the z-axis.


Ross C(Posted 2005) [#3]
That's a nice function man :D


Dock(Posted 2005) [#4]
Oh wow, I had no idea that DeltaYaw and DeltaPitch even existed! That's definitely what I need. Thanks Stevie!

Unfortunately it's still not quite working for me, I think I need to fix it. My character is twitching but snapping back to the original position. It's strange, as I have a manual 'turnentity' command just before it which works fine and retains its position.

Is the online Blitz3D manual the only version available anymore btw? [EDIT] nope, I found it! sorry!


Baystep Productions(Posted 2005) [#5]
Yeah, I think looking in the Code Archives theres a set of functions that will do this same thing, but with different variations, I forgot where though. Has to deal with AI and all.


Stevie G(Posted 2005) [#6]
Try using the global param for Turnentity ... this may be your issue.

Stevie


big10p(Posted 2005) [#7]
Calculate the vector from the source entity to the dest entity and then use AlignToVector - it has a 'rate' parameter that lets you gradually turn the entity to point at the other.


jhocking(Posted 2005) [#8]
Use TFormPoint (or do you want TFormVector? I can't remember off the top of my head) for big10's suggestion.


big10p(Posted 2005) [#9]
Don't think you even need to TFormVector, just get the world vector with:
vx# = EntityX(dest_ent,1) - EntityX(source_ent,1)
vy# = EntityY(dest_ent,1) - EntityY(source_ent,1)
vz# = EntityZ(dest_ent,1) - EntityZ(source_ent,1)



Ross C(Posted 2005) [#10]
Or, have a pivot. Place it the way the camera is facing. When you want to turn and face something, move the pivot towards the entity you want to face, and point the camera at the pivot :o)


Dock(Posted 2005) [#11]
Ross C - wouldn't your suggestion only work in first-person? I don't intend to move my camera much in my game. :)

Everyone else, I'm trying these techniques but I'm always getting the same problem. The character 'snaps'... but I'm starting to think that's something to do with the animation.

As for the rotation code, still having trouble applying this too, as my object seems to always tilt in completely wrong dimensions.


Ross C(Posted 2005) [#12]
First person? Not really, i worded that badly :o). Just replace camera with the entity you want to turn :o)


Stevie G(Posted 2005) [#13]

As for the rotation code, still having trouble applying this too, as my object seems to always tilt in completely wrong dimensions.



The rotation code works fine for me .. Is your model pointing along the z-axis?