Help with your scripting

Entity or Controller

Entity or Controller

Postby SpiderMack » 28 Sep 2017, 22:51

Hi,

What is the main difference between Entity or Controller, when we need to move AI characters ?

If the character have physics , is Entity.move using physics and collision ?

Controller seem to have more physics control built in (aside with animations definition and input mapping).
User avatar
SpiderMack
Skyline Expert
 
Posts: 441
Joined: 02 Dec 2016, 09:15
Skill: Concept artist
Skill: 3D Modeller
Skill: Level Designer
Skill: Scripter

Re: Entity or Controller

Postby SolarPortal » 29 Sep 2017, 10:22

Entity is the rendered asset in the scene. If you have no physics applied to an entity in the scene, then you can use the entity.move() command as normal. However, if you have physics action "Physics RigidBody" attached to the entity you are scripting, then you would have to use the physics.library() commands(generally forces for dynamics) to move the body as the physics body moves and rotates the entity in the scene automatically as part of skyline's main frame update. This is why when you place a dynamic ball in the scene it falls but there is no more movement code required.

Now, this paradigm changes when it comes to characters and there are 2 different routes:
1) Using the action "Simple Character Controller"(SCC). If you use this action, then the character capsule is setup via the action and you need to use the character.library() functions to move the capsule around, which in turn moves the rendered entity.
http://www.chi-ad.com/Skyline/API/Lua/html/classcharacter.html

2) If you have no actions applied apart from a micro script and you dynamically spawn the character capsule through the DCC system. Then you need to use the lua controller.library() commands instead of the character ones.
Confusing i know and we have plans of improving these.
http://www.chi-ad.com/Skyline/API/Lua/html/classcontroller.html

For both of these character/controller systems, since a physics character capsule does not rotate, the forward movement applied to the character.library() functions is that of the entities forward axis. So for example, if you call move on the character controller using character.move(obj, 1), then the character will move in the entities forward direction. If you were to rotate the entity using the entity.yaw() command, the move of the character controller would start the turn the character around.
This is the same for both the character and controller lua libraries.

So to recap:
* No physics at all: entity.library() commands.
* Rigidbody applied to entity: physics.library() commands
* SCC action applied(no rigidbody): character.library() commands.
* DCC action applied(fully scripted): controller.library() commands.

Hope this helps :D
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Entity or Controller

Postby SpiderMack » 29 Sep 2017, 11:29

Yes, character is confusing :lol:
I hope it will get some revamp later for better Api.
User avatar
SpiderMack
Skyline Expert
 
Posts: 441
Joined: 02 Dec 2016, 09:15
Skill: Concept artist
Skill: 3D Modeller
Skill: Level Designer
Skill: Scripter


Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 10 guests

cron