Jump to content

Alessandro

Members
  • Posts

    96
  • Joined

  • Last visited

Posts posted by Alessandro

  1. Thank you both of you.

     

    @Lumooja that the approach I had, but sometimes I have problems when car is near the treeshold, or even near speed 0. In fact, when I drive a car, I expect that if I use the handbrake the car completely stopped, but using AddTorque (or similar) it is almost impossible to set the precise force to let the vehicle stop and not starting to go in the opposite direction!

     

    @diedir I tried a solution similar to yours (using friction, in order to allow the car stop completely), but it seems friction on the chassis has no effect ( I even tried huge values like 10000 but nothing!). Furthermore I cannot apply friction to the tires since the tires are not physics based, but they are controlled by Josh's vehicle algorithm.

     

    Do you use tires as models (LoadModel) and not as mesh (LoadMesh)? When I tried to use tires as models I could not apply entityType for collsions since LE locked (going VERY SLOW). And if I simply load LoadModel(tire) it seems it has no real effect.

     

    I think I will need definitively spend some time to make a real Newton vehicle, since I'm creating a free-roaming game based on vehicles, and I need good car physics. I'm working with this non-physics vehicle (createed by Josh) but it seems really limited for my purpose.

     

    It's funny that LE is presented as a system to make vehicles with arbitrary tires, but no one knows how to do that (and Josh does not help us in any way), and the only vehicle created does use physics in a limited way, just to create a car arcade-style.

     

    However, I will try again using Newton physics and joints, and if you have any news from this point of view, please keep me informed ( I will do the same if I will be able to get good results with Newton).

     

    Cheers

  2. Hello,

    I need to simulate hand brake in standard LE vehicle built-in.

    I tried to use AddTorque but it is difficult to manage, since reversing tire force (rear wheels) I cannot really stop the vehicle, and somtimes the vehicle start to run in the opposite direction.

     

    Is there any other way to do that?

     

    local myVel = self.chassis:GetVelocity(0)
    myVel = (myVel.x + myVel.y + myVel.z) * 2.5
    
    if KeyDown(KEY_SPACE) == 1 then
    
    	if math.abs(myVel) > 30 then
    		self.car:AddTireTorque(-10000, 2)
    		self.car:AddTireTorque(-10000, 3)	
    	else
    		self.car:AddTireTorque(0, 0)
    		self.car:AddTireTorque(0, 1)			
    		self.car:AddTireTorque(0, 2)
    		self.car:AddTireTorque(0, 3)			
    	end
             end
    

  3. Hello, I finally tried to implement your suggestion, but not work. In fact, if I do not apply EntityType for collision, then nothing changed (car behaviour does not change), instead if I apply entitytype as:

     

    EntityType(object.tire[n], 1)

     

    Well, LE hangs (slow down the entire engine!).

     

    I think it is logical, since vehicle built functions created by Josh use a different way (rays) to simulate wheels collision, so I think those methods go in conflict.

  4. There is a drawing hook that you can assign a Lua method to and inside there you can draw 2D stuff like text.

     

    AddHook("Flip", MyFunction)

     

    "Flip" is a keyword and for drawing you need that, then the function can be any Lua function.

     

    function MyFunction()

    -- Draw images or text here

    end

     

    Thank you Rick! I will test it tonight (I'm at work now :-)

  5. Hello,

     

    I need to change directional light color in order to simulate the atmosphere colors in the morning and evening (day/night cycle).

    I used the following code, and putted in Update() event in the light self:

     

    light_1.light.color = Vec3(myRed, myGreen, myBlue)
    

     

    The problem is, every some seconds, I see in the screen something like a flash white (imagine a lighting in the sky, which enlighten all the environment for a few frames).

     

    Is my code correct? Is there any other way to simulate color changing?

     

    Thank you for your help!

  6. You can use wheels with a physics model and still do it like in the driver.lua example. The wheels will collide with things just fine, but of course they won't get any force impact back since you use SetEntityMatrix() on them which eliminates reverse physics force. But collisions still work fine.

     

    Please can you better explain me what you mean?

  7.  

     

    Thank you, I will check them.

    I own 3dgs also, and I tried to follow the new vehicle system they use, but is difficult since they use PhysX engine, and API (and their usage) are really different (and I abandonded the conversion).

     

    I will check your links (maybe we can extract something good :-)

     

     

    EDIT:

    A couple of links have the same problem I already found in the past: they refere to a specifi object class existing in Newton engine. This class is specialized to make vehicles.

    As per my knowledge, we haven' that class in LE, so we need to create a vehicle from scratch (using basic joints).

     

     

     

    Thank you!

  8. //The animations are the ones used to simulate wheel movement (up/down) for suspensions.

     

    And wheels rotation :)

     

    Well, i'm also interested in car with physic wheels, not raycast. Looking like we need to dig into Newtons header and get physic car functions from there.

     

    I tried to get some newton programs made in other languages, but it is not easy to convert them in LE style, since Newton implement a simplifed version of the vehicle using special API, and those api are not implementd in LE.

    I cannot find clear information how to create a real vehicle even in newton self.

    If you can find a source code in any language showing how to create a real vehicle, please send me that, and I will try to convert it in LE (LUA).

    Then I will send you the converted code ;)

  9. Have you tried using the Create vehicle command?

    I agree with the documentation on joints. It is not sufficient for most people to make something work with it.

     

    Did you have a look at the driver scripts and viper scout script?

     

    Of course, I successfully used them. But that is a partially simulated vehicle (it uses raycast and anims to simulate tires and car movement).

    I need a realistic car feedback :)

  10. Ok, setting a Newton vehicle in LE is a mess. Too many information are missing!

    Pleae Josh give me some hints how to proceed or I will push myself under a real car :)

     

    Now I have this code (not work):

     

    function class:CreateObject(argModel)
    local object=self.super:CreateObject(argModel)
    
    local myWheelFL = LoadModel("abstract::" .. "vehicleProtoWheel.gmf", object.model)
    local myWheelFR = LoadModel("abstract::" .. "vehicleProtoWheel.gmf", object.model)
    local myWheelRL = LoadModel("abstract::" .. "vehicleProtoWheel.gmf", object.model)
    local myWheelRR = LoadModel("abstract::" .. "vehicleProtoWheel.gmf", object.model)
    
    if myWheelFL == nil then
    	Notify("Errore creazione myWheelFL")
    	return
    end
    if myWheelFR == nil then
    	Notify("Errore creazione myWheelFR")
    	return
    end
    if myWheelRL == nil then
    	Notify("Errore creazione myWheelRL")
    	return
    end
    if myWheelRR == nil then
    	Notify("Errore creazione myWheelRR")
    	return
    end
    
    --local locFL = TFormPoint(Vec3(-1.6, -0.8, -2)	, object.model, nil)
    local locFL = Vec3(-1.6, -0.8, -2)
    myWheelFL:SetPosition(locFL)
    
    --local locFR = TFormPoint(Vec3(-1.6, -0.8, 2)	, object.model, nil)
    local locFR = Vec3(-1.6, -0.8, 2)
    myWheelFR:SetPosition(locFR)
    
    --local locRL = TFormPoint(Vec3(1.6, -0.8, -2)	, object.model, nil)
    local locRL = Vec3(1.6, -0.8, -2)
    myWheelRL:SetPosition(locRL)
    
    --local locRR = TFormPoint(Vec3(1.6, -0.8, 2)	, object.model, nil)
    local locRR = Vec3(1.6, -0.8, 2)
    myWheelRR:SetPosition(locRR)
    
    local myWheelRLJoint = CreateJointSlider(object.model, myWheelRL, locRL, Vec3(locRL.x, locRL.y+0.2, locRL.z))
    local myWheelFLJoint = CreateJointSlider(object.model, myWheelFL, locFL, Vec3(locFL.x, locFL.y+0.2, locFL.z))
    local myWheelRRJoint = CreateJointSlider(object.model, myWheelRR, locRR, Vec3(locRR.x, locRR.y+0.2, locRR.z))
    local myWheelFRJoint = CreateJointSlider(object.model, myWheelFR, locFR, Vec3(locFR.x, locFR.y+0.2, locFR.z))
    
    
    --[[**********************************************************************************************
    **********************************************************************************************]]--
    function object:Free()
    
    	--[[-----------------------------------------------------------------------------------------
    	-----------------------------------------------------------------------------------------]]--
    
    	if myWheelFLJoint ~= nil then
    		FreeJoint(myWheelFLJoint)
    		myWheelFLJoint = nil 
    	end
    	if myWheelFRJoint ~= nil then
    		FreeJoint(myWheelFRJoint)
    		myWheelFRJoint = nil 
    	end
    	if myWheelRLJoint ~= nil then
    		FreeJoint(myWheelRLJoint)
    		myWheelRLJoint = nil 
    	end
    	if myWheelRRJoint ~= nil then
    		FreeJoint(myWheelRRJoint)
    		myWheelRRJoint = nil 
    	end
    
    	--[[-----------------------------------------------------------------------------------------
    	-----------------------------------------------------------------------------------------]]--
    
    	if myWheelFL ~= nil then
    		myWheelFL:Free() 
    		myWheelFL = nil 
    	end
    	if myWheelFR ~= nil then
    		myWheelFR:Free() 
    		myWheelFR = nil 
    	end
    	if myWheelRL ~= nil then
    		myWheelRL:Free() 
    		myWheelRL = nil 
    	end
    	if myWheelRR ~= nil then
    		myWheelRR:Free() 
    		myWheelRR = nil 
    	end
    
    	self.super:Free()--Don't forget this!! end
    end
    
    function object:Update()	
    	--self.model:Turn(Vec3(GetEntityKey(self.model, "Rotate X"), -1 * tonumber(GetEntityKey(self.model, "Rotate Y", 0)), GetEntityKey(self.model, "Rotate Z")))
    end
    
    
    end

     

     

    JOints not work, and I cannot understand how to manage them.

    I stored tires as separated models, and I create them as child of the chassis.

    Not work.

     

    And this is a screenshot:

    http://www.mediafire.com/?h87o7eb7z5ukb

     

     

    PLEASE!! I need a real vehicle model! PLEASE JOSH! :):(

  11. object.joint = CreateJointSlider(myWheelFL, Vec3(-1.6, -0.8, 2), Vec3(-1.6, 0, 0))

     

    The exact syntax (from documentation) is:

     

    object.joint = CreateJointSlider(object.model, myWheelFL, Vec3(-1.6, -0.8, 2), Vec3(-1.6, 0, 0))

     

    In fact you forgot the parent object :)

     

    Cheers! (thank you again!)

  12. What should this line be doing?

    "abstract::" .. "vehicle_proto_wheel.gmf"

     

    Shouldn't it just be:

    "abstract::vehicle_proto_wheel.gmf"

     

    Yes, you are right, it was in the first form since the wheel name will be stored in a variable:

     

    "abstract::" .. locWheelName

     

    :)

     

    @macklebee, thank you for your help.

    Even if LUA seems a very important piece inside LE, its documentation is not enough, and not clear.

     

    I wish a better documentation for the future.

     

    Thank you again!

  13. Hello,

    I need to create slider joint to make a suspension, but I get always an errore from LE.

    This is the code:

     

    	local myWheelFL = LoadModel("abstract::" .. "vehicle_proto_wheel.gmf", object.model)
    local myWheelFR = LoadModel("abstract::" .. "vehicle_proto_wheel.gmf", object.model)
    local myWheelRL = LoadModel("abstract::" .. "vehicle_proto_wheel.gmf", object.model)
    local myWheelRR = LoadModel("abstract::" .. "vehicle_proto_wheel.gmf", object.model)
    
    if myWheelFL == nil then
    	Notify("Errore creazione wheel")
    	return
    end
    
    myWheelFL:SetPosition(Vec3(-1.6, -0.8, -2))
    myWheelFR:SetPosition(Vec3(-1.6, -0.8, 2))
    myWheelRL:SetPosition(Vec3(1.6, -0.8, -2))
    myWheelRR:SetPosition(Vec3(1.6, -0.8, 2))
    
    -- ******* THIS FUNCTION CALL GIVE ME THE ERROR ***********
    object.model:CreateJointSlider(myWheelFL, Vec3(-1.6, -0.8, 2), Vec3(-1.6, 0, 0))
    

     

     

    I get "Index for object is not a valid field or method".

    If instead I use

    object.model:CreateJointSlider(myWheelFL, Vec3(-1.6, -0.8, 2), Vec3(-1.6, 0, 0))

     

    I get:

    Attempt to call method (a nil value).

     

    But I'm sure the object pointers and the wheels are created (I check them).

     

    Please help me!

  14. Hello,

     

    as many other programmers, I'm always looking for "the perfect text editor". Well, I used several editors (even to write LUA apps), but everyone seems "another copy" of the others. It seems every new editor includes the same functions of other editor.

    I haven't a Mac, but I was surprised to see Textmate.

    But... just s couple of days ago, I finally found "my perfect editor"! It is called "Sublime Text":

     

    http://www.sublimetext.com

     

    It works in Windows, contains many functions found in any traditional editor plus Textmate.

    But it has some absolutely incredible functionalities! I really love it.

    Even if it is not free (it is not so cheap also!), it is really amazing. Look at these functions:

     

    http://www.sublimetext.com/support

     

    I just bought it!

     

    Cheers!

  15. Hello,

     

    since I need to make a realistic vehicle, I wanted to create it using Newton joints.

    I'm not so experienced in LE, so I started using DRIVER.LUA (just to get a guideline).

    Now I notice that such script uses CreateObject() to create the vehicle (chassis is the only real physics thing).

    Instead I need to create chassis + wheels (as BODY in order to apply sliderJoint).

    I cannot find the right way to start from.

    After the user start the program, the object chassis will be created:

     

    function class:CreateObject(model)
    

     

    Then...

     

    local object = self.super:CreateObject(model)
    object.vehicle = CreateVehicle(object.model)
    

     

    Ok, where and how can I load wheel physics? In the original code the wheels do not exist as physic entities. Do you suggest me to create separated tire and its related PHY file?

    Or can I use the tire already stored in the vehicle model ( see VIPER as an example)?

     

    Please highlight my dark way :blink: since I'm very confused.

     

    Thank you for your help!

×
×
  • Create New...