Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2009-05-18 12:22:51 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2009-05-18 12:22:51 +0400
commit07fc2aa5268da7708a289fa785b0f0cbd9be2575 (patch)
tree9bbe540d1853f2a259b64b8d51ad2bf142c3cdda /source/blender/blenloader
parent3bda88babfd422e2b40377d8d3be9a4bda7ed997 (diff)
BGE #18665: Servo control and relative motion
Servo control motion actuator did not work as expected when the object is moving on a moving platform. This patch introduces a new Ref field in the servo motion actuator to set a reference object for the velocity calculation. You can set the object during the game using the actuator "reference" attribute; use an object name or an object reference. The servo controller takes into account the angular velocity of the reference object to compute the relative local velocity.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 91557da7aa6..0f233410f4e 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3077,6 +3077,10 @@ static void lib_link_object(FileData *fd, Main *main)
bAddObjectActuator *eoa= act->data;
if(eoa) eoa->ob= newlibadr(fd, ob->id.lib, eoa->ob);
}
+ else if(act->type==ACT_OBJECT) {
+ bObjectActuator *oa= act->data;
+ oa->reference= newlibadr(fd, ob->id.lib, oa->reference);
+ }
else if(act->type==ACT_EDIT_OBJECT) {
bEditObjectActuator *eoa= act->data;
if(eoa==NULL) {
@@ -3087,6 +3091,15 @@ static void lib_link_object(FileData *fd, Main *main)
eoa->me= newlibadr(fd, ob->id.lib, eoa->me);
}
}
+ else if(act->type==ACT_OBJECT) {
+ bObjectActuator *oa= act->data;
+ if(oa==NULL) {
+ init_actuator(act);
+ }
+ else {
+ oa->reference= newlibadr(fd, ob->id.lib, oa->reference);
+ }
+ }
else if(act->type==ACT_SCENE) {
bSceneActuator *sa= act->data;
sa->camera= newlibadr(fd, ob->id.lib, sa->camera);
@@ -8862,6 +8875,10 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
expand_doit(fd, mainvar, eoa->me);
}
}
+ else if(act->type==ACT_OBJECT) {
+ bObjectActuator *oa= act->data;
+ expand_doit(fd, mainvar, oa->reference);
+ }
else if(act->type==ACT_SCENE) {
bSceneActuator *sa= act->data;
expand_doit(fd, mainvar, sa->camera);