astrofish
04-22-2003, 12:42 AM
The 'bouncing ball' XPresso tutorial in the R8 tutorial manual has a bug in it...
The tutorial uses an 'Align to path' tag to get the ball to follow a circle, and an XPresso tag to get it to bounce.
The 'Align' tag is arranged to execute before the XPresso tag, so that the align tag doesn't overwrite our Y coordinate writen by the XPresso script. I.e. 'align' sets the ball position, then XPresso modifies the Y coordinate.
The problem is that the XPresso (XP from now on) node is also being used to set an input of the align tag, and since the align tag has to be executed first, it is always using data from the previous frame. This is not a good thing. For example, scrubbing the animation slider will not give the same results as normal playback.
I have attached a file that demonstrates two different methods to solve this problem.
The first approach is to use nulls. The 'align' tag makes a null follow the path, and the XP tag sets the Y coord of a child null. Because the tags are now controlling different things, there is no overwriting problem. The XP tag is now set to execute first (by having the tag earlier in the list) so that it can set the align input parameter for this frame correctly.
The second approach - which is probably easier to understand simply splits the XP tag into two. The sequence of tags is then:-
XP1 - Sets input of 'Align'
Align - Aligns sphere to path.
XP2 - Sets spher bounce height.
In both cases I've also included intermediate nulls to act as 'handles' so that the sphere bounces on the Y=0 plane, rather than bouncing 'through' it.
The project file is here. (http://www.astrofish.com/bitsandbobs/xpresso2bouncingball1.c4d)
Cheers - Steve
The tutorial uses an 'Align to path' tag to get the ball to follow a circle, and an XPresso tag to get it to bounce.
The 'Align' tag is arranged to execute before the XPresso tag, so that the align tag doesn't overwrite our Y coordinate writen by the XPresso script. I.e. 'align' sets the ball position, then XPresso modifies the Y coordinate.
The problem is that the XPresso (XP from now on) node is also being used to set an input of the align tag, and since the align tag has to be executed first, it is always using data from the previous frame. This is not a good thing. For example, scrubbing the animation slider will not give the same results as normal playback.
I have attached a file that demonstrates two different methods to solve this problem.
The first approach is to use nulls. The 'align' tag makes a null follow the path, and the XP tag sets the Y coord of a child null. Because the tags are now controlling different things, there is no overwriting problem. The XP tag is now set to execute first (by having the tag earlier in the list) so that it can set the align input parameter for this frame correctly.
The second approach - which is probably easier to understand simply splits the XP tag into two. The sequence of tags is then:-
XP1 - Sets input of 'Align'
Align - Aligns sphere to path.
XP2 - Sets spher bounce height.
In both cases I've also included intermediate nulls to act as 'handles' so that the sphere bounces on the Y=0 plane, rather than bouncing 'through' it.
The project file is here. (http://www.astrofish.com/bitsandbobs/xpresso2bouncingball1.c4d)
Cheers - Steve
