≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
I used a script that fixes a problem related to horizontal rotations. Please modify it so it also works for vertical rotations!
Posted by:
(you are not logged in)
Enter the missing letter in: "Intern?tional"
(you are not logged in)
Text:
[quote][b][/b] wrote: At this page, Niko said the engine uses quaternion rotations internally for the Artificial Intelligence code: [url]http://ambiera.com/forum.php?t=3746[/url] When I read that, I was inspired and compelled to try to overcome our rotational problems: [b]1.[/b] I right-clicked the root node of my project, hovered over "Insert", and clicked "Create a Path". My path is called "Path1". [b]2.[/b] I added the Behavior called "Game Actor with Health" to my character. Inside of the properties section of that behavior, I chose the Mode called "Walk along a Path", and I chose "Path1" as the path it must follow. [b]3.[/b] Instead of moving my character with keyboard buttons, I use my keyboard buttons to move toward the Path1 node, and my character follows it! With that method, my character follows the path and rotates toward it, but it follows EVERY movement of the path, instead of ONLY following its most current location. After I was filled with sadness, I thought of this other method to force it to ONLY move toward the most current location of an object: [b]1.[/b] I created a sphere named "sphereMesh1" as an object. [b]2.[/b] Instead of moving my character with keyboard buttons, I move the sphere, and my character follows it. [b]3.[/b] I used a behavior called "Every few seconds, do something", and I put this JavaScript code inside of it: [code]var player = ccbGetSceneNodeFromName("Player"); var Sphere = ccbGetSceneNodeFromName("sphereMesh1"); var PositionOfSphere = ccbGetSceneNodeProperty(Sphere, "Position"); ccbAICommand(player, "moveto", PositionOfSphere);[/code] With that JavaScript feature called [b]ccbAICommand[/b], my character follows the most current location of the sphere! The previous method that used the "Path" feature was worse because my character followed EVERY movement, like a trail, instead of only following the current location of the object. But the method that uses the JavaScript code doesn't rotate my character! It moves toward the sphere in all vertical and horizontal locations, but it doesn't look toward my character! The method that used the "Path" method rotated my character! I have a very important question here: When I use the [b]ccbAICommand[/b] code on my enemies, some of them actually rotate toward every direction perfectly! I use "moveto" to move them toward my main character, and some enemies actually rotate toward every vertical and horizontal position that my character moves to! But some enemies also just move toward my character without rotating! Why does the "moveto" feature of the [b]ccbAICommand[/b] feature occasionally make characters rotate while they're moving, and occasionally only moves them without rotating them so they'll face their targets? I'd share an example, but I probably don't still have a CCB file that shows some enemies that move WITHOUT rotating. I've tried debugging by setting the "Game Actor with Health" feature to "This is the Player", and then "Stand Still", and I've tried with characters that have cameras attached, and some that don't have cameras attached, and I haven't discovered why the "moveto" feature occasionally rotates objects while moving them and occasionally doesn't. If we learn how to make the "moveto" option of the [b]ccbAICommand[/b] rotate our objects every time, we could force characters to move toward tiny invisible objects that are very close to them, so we won't need to rotate them directly. People who play our games will still feel like they're controlling our characters! They'll never know that they're actually controlling tiny invisible objects and the main characters just walk toward them! Tell me if my idea is idiotic or disgraceful![/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact