How is it possible to make so many mistakes in a little script ? It is pitiful.
And my comment relative to the "isImmobile" setting was also wrong.
Indeed that setting must be enabled is we need the immobility of an object if this one may not move when it is collided.
(I think that the little part of my brain where there was some ability for programming has been replaced by ... by what ? )
I hope that this new version of the script is the good one :
g_EntityNames = g_EntityNames or {}
g_EntityNumber = g_EntityNumber or {}
function lamborghini_init_name(e, name)
g_EntityNames[ e ] = name
g_EntityNumber[ name ] = e
rotationY = 0
moveX = 0
inkey = 0
end
function lamborghini_main(e)
Prompt ("hello, I am the script lamborghini.lua")
local entityname = g_EntityNames[e]
local entityId = g_EntityNumber[ entityname ]
rotationY = rotationY + 1
if rotationY > 360 then
rotationY = 1
end
-- [s]1000 GameGuru MAX units = approximately 50 centimeters (I hope it)[/s]
-- new hypothesis : 1000 GameGuru MAX units = 20 meters ! (according to measurements explained in this comment)
moveX = moveX + 1000
entityPosition = math.ceil(GetEntityPositionX(entityId))
inkey = tonumber(g_InKey)
if inkey ~= nil then
if inkey == 1 then
MoveBackward(entityId,moveX)
PromptLocal (entityId, entityname .. " : current position on X axis " .. entityPosition )
elseif inkey == 2 then
MoveForward(entityId,moveX)
PromptLocal ( entityId, entityname .. " : current position on X axis " .. entityPosition )
elseif inkey == 3 then
SetRotation(entityId,100,rotationY,100)
PromptLocal ( entityId, entityname .. " : facing current angle on Y axis " .. rotationY )
end
Prompt ( "OK!")
end
end
Edited on 2021-December-15th (1:40pm gmt+1) :
I had a serious doubt about the length of a GameGuru MAX unit in a level.
In my script I commented that "1000 GameGuru MAX units = approximately 50 centimeters ( I hope it)".
And today I tried to take some measurement in a experimental project.
Workflow :
1) Creation of a cube-shaped model in my modeller which has a feature to accurately take measurements on a 3D mesh.
2) The model has these dimensions ( Height 100 meters , Width 50 meters and Length 75 meters).
3) Before exporting that model, I rescale it to 1/20th of its first version, because according to many experiments with the export of meshes created with my modeller I found that this scale's conversion was correct.
To verify that assumption, I tested some small models imported in GameGuru MAX and I compared them with one of the characters included in the packs of GameGuru MAX. For the tests I assumed that the height of a character could be evaluated between 1.70 meter and 2 meters).
4) The high cube-shaped model is then imported in GameGuru MAX and it is placed on a flat surface of a terrain.
5) Another object is placed at the top of the cube-shaped model.
6) The difference in GameGuru MAX units between the Y position of the two objects is compared to the rescaled original model.
7) In this way I found a difference of approximately 5,000 GameGuru units between the Y positions of the two objects.
8) I divided the original height of the cube-shaped model ( 100 meters) by those 5,000 GameGuru units and it gave a result of approximately 0.02 meters = 2 centimeters.
9) According to that result found in that experiment I assumed that 1,000 GameGuru MAX units is equal to 20 meters.
But now the question that I am asking myself is the following : "Could the length of a GameGuru MAX unit remain constant if the terrain where it was calculated has a specific dimension ( a square of 2 kilometers or another one of 5 kilometers) ? ". Anyway I don't remember how I previously calculated that 1,000 GameGuru MAX was equal to 50 centimeters.
But why did I feel so concerned by the length of a GameGuru MAX in this experiment with the Physics Engine ?
Simply because I noticed that the car and the tyre to which the behavior was applied were moving very fast each time that I pressed the key [1] or the key [2].
And the car was nearly flying like a dead leaf blown by the wind.
Of course a few other settings have an incidence on the way the car is interacting with the Physics Engine, mainly these two ones : the parameter "Weight of Object" and "Object's Friction".
I tested the behavior with this line of code (comment is also modified) :
-- 1 GameGuru MAX unit = approximately 2 centimeters (I hope it)
moveX = moveX + 1
and I noticed that the car is a little bit more stable on the surface of the terrain when it is moved forward or backward.
I hope that my trials and errors could motivate some seekers to discover the best settings to move an engine in a GameGuru MAX project.