- Learning Game AI Programming with Lua
- David Young
- 258字
- 2021-08-05 17:02:14
Physics
Even though agents are simulated with physics, not all of the agent's physics parameters are enforced at the physics simulation level. The mass of an agent, for example, is the identical mass used within the physics simulation itself, while the MaxForce
and MaxSpeed
functions of an agent are only enforced by the agent. These two properties represent the maximum amount of force an agent can exert on itself and the max speed the agent can reach without any outside influences.
An intuitive example of why this separation is desirable when dealing with agent physics is gravity. When an agent accelerates to its max speed, we still want gravity to accelerate the agents downward in the case of falls. This acceleration can force agents to have a speed larger than their max speed property.
Mass
To access and modify the mass of our agents we can use the agent's GetMass
and SetMass
helper functions.
local mass = agent:GetMass(); agent:SetMass(mass);
The max force
The maximum force of our agents can be accessed and set using the GetMaxForce
and SetMaxForce
functions.
local maxForce = agent:GetMaxForce(); agent:SetMaxForce(maxForce);
The max speed
To set and access the max speed property of our agents, we can use the GetMaxSpeed
and SetMaxSpeed
functions.
local maxSpeed = agent:GetMaxSpeed(); agent:SetMaxSpeed(maxSpeed);
Speed
Setting and accessing the speed of our agents can be done through the GetSpeed
and SetSpeed
functions.
local speed = agent:GetSpeed(); agent:SetSpeed(speed);
Velocity
Similarly, to access and set the velocity of our agents, we can use the GetVelocity
and SetVelocity
functions.
local velocityVector = agent:GetVelocity(); agent:SetVelocity(velocityVector);
- Unity 5.x Game AI Programming Cookbook
- 云計(jì)算服務(wù)保障體系
- PySpark大數(shù)據(jù)分析與應(yīng)用
- Live Longer with AI
- Neural Network Programming with TensorFlow
- 數(shù)據(jù)驅(qū)動(dòng)設(shè)計(jì):A/B測(cè)試提升用戶(hù)體驗(yàn)
- 數(shù)據(jù)架構(gòu)與商業(yè)智能
- Mastering LOB Development for Silverlight 5:A Case Study in Action
- R Object-oriented Programming
- 智慧城市中的大數(shù)據(jù)分析技術(shù)
- 計(jì)算機(jī)視覺(jué)
- 數(shù)據(jù)挖掘競(jìng)賽實(shí)戰(zhàn):方法與案例
- 改進(jìn)的群智能算法及其應(yīng)用
- Google Cloud Platform for Architects
- 區(qū)塊鏈應(yīng)用開(kāi)發(fā)指南:業(yè)務(wù)場(chǎng)景剖析與實(shí)戰(zhàn)