THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 21/04/2012 at 11:19, xxxxxxxx wrote:
Cinema 4D Version: R13
Platform: Windows ; Mac ;
Language(s) : C++ ;
I am having some weird results using GetSplinePoint()
Basically I fill a Vector with:
Real dist = bc->GetReal(MY_DIST_PERCENTAGE);
Vector spos = spline->GetSplinePoint(dist, 0, NULL);
I then set the position of objects to spos so that they will move along a certain percentage of the spline.
when I increase or decrease the dist percentage, I get random spurts of GetSplinePoint() returning Vector(0,0,0); which makes my objects jump randomly back to the start of the spline . Is this a known issue with GetSplinePoint() or am I doing something wrong?
On 23/04/2012 at 05:17, xxxxxxxx wrote:
Any thoughts on this?
On 23/04/2012 at 07:44, xxxxxxxx wrote:
I've recently done something similar and used the SplineHelp class to do it. In my case I wanted to know the actual global position in the 3D world represented by a given percentage along a spline. The SplineHelp::GetPosition() function works fine for that.
If you needed to know the nearest point in the spline to the percentage distance, you could try SplineHelp::GetPointIndex().
Hope that helps a little.
On 23/04/2012 at 08:02, xxxxxxxx wrote:
Thanks Steve! I'll check those functions out when I get home. I wish I had a portable SDK on my iPhone. Lol
On 23/04/2012 at 14:11, xxxxxxxx wrote:
Hmmm.. well, that works like it's supposed to just like GetSplinePoint() but I sitll get random flickers back to the beginning of the spline. This is weird. It must be earlier in the chain before I build the spline. Back to the drawing board,.
On 23/04/2012 at 15:21, xxxxxxxx wrote:
Is this a spline with more than one segment by any chance? I had trouble getting my code to work with segments other than the first one. Gave up in the end, it wasn't critical.
On 23/04/2012 at 15:24, xxxxxxxx wrote:
Yes it has more than one. Unfortunately it is critical in my setup. Lol
Thanks again Steve.
On 23/04/2012 at 19:02, xxxxxxxx wrote:
Okay, when the object jumps back to the base of the spline, the console prints out the value of the vector created by SplineHelp::GetPosition() as
Vector(-1.#QO, -1.#QO, -1.#QO);
Any idea what that means?
On 24/04/2012 at 00:55, xxxxxxxx wrote:
The problem is clearly the use of more than one sesgment. I couldn't fix this, maybe someone with more knowledge could show how to make it work?
That strange printout, I can only guess that it's a value incredibly close to zero without actually being zero - like you see sometimes in Visual Studio, it appears to give a really weird value for a Real but you realise that it's just an arithmetical rounding error and it's really zero.
On 24/04/2012 at 03:48, xxxxxxxx wrote:
I had some problems with SplineHelp, too, in the past. Therefore, I returned to using SplineObject::GetSplinePoint().
On 24/04/2012 at 03:50, xxxxxxxx wrote:
Interestingly I get the same results with GetSplinePoint(), You had your object along the spline return to the start? How did you resolve this?