[SOLVED] CLerpNodePathInterval wrt center point

A quick one: I want to fly an helicopter around a center point. To do this I merely try:

NodePath helicopter = window->load_model(framework.get_models(), "helicopter.egg");
helicopter.reparent_to(render);			
// round trip for fly animation
PT(CLerpNodePathInterval) helicopter_round_interval = new CLerpNodePathInterval("helicopter_round_trip", 
		8, CLerpInterval::BT_no_blend, true, false, helicopter, center_point);
helicopter_round_interval->set_start_hpr(LPoint3f( 0, 0, 0) );
helicopter_round_interval->set_end_hpr(LPoint3f(360, 0, 0) );
PT(CMetaInterval) helicopter_fly = new CMetaInterval("helicopter_fly");
helicopter_fly->add_c_interval(helicopter_round_interval, 0, CMetaInterval::RS_previous_end);
helicopter_fly->loop();

The issue is that the rotation doesn’t appear to take “center_point” as the pivot point. I’m certainly missing something?

You’re misunderstanding the purpose of the “other” parameter in the CLerpNodePathInterval constructor. It doesn’t define the origin of a rotation; rather, it defines a relative operation. It’s as if you did this every frame:

helicopter.set_hpr(center_point, LPoint3f(h, 0, 0));

which is not the same thing as rotating about center_point.

In order to rotate helicopter about a different point than its origin, make helicopter the child of a different node, set an appropriate offset on helicopter, and then rotate the parent node.

David

got it! thks.