THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/05/2007 at 15:17, xxxxxxxx wrote:
Cinema 4D Version: 10
Language(s) : C.O.F.F.E.E ;
Is there a more exact way of getting the position along a spline?
With COFFE I use something like:
var locpos = spline->GetSplinePoint(spline->UniformTonatural(position));
var spline = tag#ID_USERDATA:1;
var position = tag#ID_USERDATA:2;
var pos = GetGlobalPosition(spline,position);
The problem I have is a "pumping" position along the spline for each
point along the spline. I thought I did something wrong but
the result is the very same if I use Cinemas own AlignToSpline Tag.
The problem is the same. Using the AlignToSpline tag, of coarse setting the spline
to Uniform, and rising the subdivision to high values does not help.
Subdividing the actual (curved)spline does not help either since the subdivision does the "same"
The cumbersam way of getting it better is to create a -straight- spline that is highly
subdivided and use the Mograph Spline Warp to "glue" it to the original spline
(plus duplicate it and use a expresso setup to have a deformed state that can be used).
Lennart Wåhlin - tcastudios
On 28/05/2007 at 15:43, xxxxxxxx wrote:
As it looks, COFFEE doesn't have access to the splinehelp class to get it working..
On 30/04/2008 at 09:07, xxxxxxxx wrote:
Hey Lennart, If I understand you correctly I was encountering a similar problem. The solution I came up with was to subdivide the curves of my Bezier and then change it to a Linear spline. This gives a uniform position with Align to Spline. I made a post about this a couple days ago saying that I think there should be another type of spline for this reason.
On 30/04/2008 at 09:26, xxxxxxxx wrote:
Don´t use spline->UniformTonatural(position) before you use GetSplinePoint()?
On 30/04/2008 at 11:02, xxxxxxxx wrote:
Hey Katachi, You are definitely right that UniformTonatural should not be used in this case, but the spline will still have to be changed to linear to get truly uniform position. This is the part that I don't like.
On 30/04/2008 at 11:13, xxxxxxxx wrote:
I take back my last statement. After reading the SPK it appears that TCA was right to use UniformTonatural. Katachi, I'm not sure if your post is a question or a suggestion.
On 30/04/2008 at 11:34, xxxxxxxx wrote:
I don't have the means to double recheck that right now but the result was the same(not using the UniformTonatural function).
Back then (haven't done this test in R10.5) even the original AlignToSpline
Tag have(had?) the same problem, I compared an object animated in a perfect circle (using sin and cos) and a object using the ATS Tag along a circle spline (Both having the same radius). The "mathematical" object moved perfect and the ATS object"stuttered", looking thru a Camera from origo.
On 30/04/2008 at 13:00, xxxxxxxx wrote:
I thought I remembered a bug that made the calculations inverted, but it isn´t.
I just checked myself and I can confirm a slight offset near spline points. See this render:
(oops) GetSplinePos vs CosSin (500 KB)
The cube is the getsplinepoint option and the sphere is a cos/sin curve. Is it that what you meant? To me that´s simply a bezier interpolation difference. You most probably will never get a perfect circle movement out of it. imo it´s not a problem of the function but of the interpolation exactness (maybe if cinema 4d used double precision that offset would be gone, well at least visibly it wouldn´t look so obvious)
At least to me the calculations seem right.
On 30/04/2008 at 14:08, xxxxxxxx wrote:
Again I'm not sure if I am talking about the same thing that Lennart was initially but...My point is really easy to demonstrate. Make 2 splines 100 units long. Create 2 objects and give them align to spline tags. Make 1 spline Bezier uniform, the other Linear uniform. set position of ATS tag to 10. The Linear spline's object will be at 10, and the Bezier 9.9.
Anyway, Thanks for the input Katachi and Lennart
On 30/04/2008 at 14:28, xxxxxxxx wrote:
Back then when I brought this up at CGTalk I got the response from PerAnders, that I needed to get the underlaying "real" spline, but that
class, as it seems, is not possible to get using COFFEE. To calculate a correct equal distance subdivision using COFFEE should also, he said, be very complicated. I've not looked into it since then but the odd part still remains,
that the Cinema AlignToSpline also have this "miscalculation".
(Or at least had then).
I shall look into this again later this year for further development.
On 30/04/2008 at 16:05, xxxxxxxx wrote:
@superape: hmm, both get 10 here. What c4d version are you using? I use 10.111 here.
@tcastudios: GetSplinePoint should give you the same position as getting the LineObject (which is what is the real spline he was talking about). Even if you had access to the Line object, you would still use GetSplinePoint. Imo, that shouldn´t make any difference. It is an interpolation difference to me, but the test I made with superapes example works fine here.
On 30/04/2008 at 16:18, xxxxxxxx wrote:
I will definitely (and have to) look at this again, but I'm tied up for a month
Initially this problem popped up when I wanted to align several animated objects along a spline with a fixed distance between them independent of
speed and splinetype.
(Like a train).
There -are- workarounds, but each situation then gets a separate
solution instead of a more simple to use generic "MultiAlignToSpline"-
Till then Cheers
On 01/05/2008 at 05:25, xxxxxxxx wrote:
Hi Katachi, I use 10.5. Maybe I have some settings set wrong. I'm going to play around now that you say you get 10 for both. Thanks
On 14/05/2008 at 00:58, xxxxxxxx wrote:
It's a known and reported bug with Bezier splines.
On 14/05/2008 at 05:25, xxxxxxxx wrote:
Thanks for the info Matthias