Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Vehicle Help Needed  (Read 876 times)
TripleView
Community Member
*
Posts: 32


« on: August 04, 2011, 02:13:02 PM »

I have a model the exact same size as the last one I was using but when I load it as a vehicle the wheels move to the right. Even telling the engine exactly where they need to go they still don't go in the right location.

They should load onto it like this:

But rather the wheels move to the left

& back


Like I said I have tried setting them to the exact location they need to be from 0,0,0 but they don't go in the right location.
The plane there is nothing at first I thought the wing on the back was tossing the bounding box off and the wheels but...
like 10 hours and still can't get it right.
Logged
Dimple
Community Member
*
Posts: 580


« Reply #1 on: August 04, 2011, 08:10:16 PM »

 Smiley

1. Are you using Newton, and if so are you using the older dll(from whichever language you are using).

2. look at the code below and see if the steering in it will work for you.  1/2 in 1st post & the rest in the next...... grrrr....

Code:
Option Strict Off
Option Explicit On
' Import the MTV3D65 library.
Imports MTV3D65
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Public Class frmCanvas

    Public tv As TVEngine
    Public scene As TVScene
    Public input As TVInputEngine
    Public globals As TVGlobals
    Public maths As TVMathLibrary
    Public texturefactory As TVTextureFactory
    Public materialfactory As TVMaterialFactory
    Public camera As TVCamera
    Public viewport As TVViewport
    Public lights As TVLightEngine
    Public atmosphere As TVAtmosphere
    Public physics As TVPhysics

    'Game
    Public bDoLoop As Boolean

    'Terrain
    Private Land As TVLandscape
    Private pbLand As Integer

    'Materials
    Private matLand As Integer
    Private matVehicleBody As Integer
    Private matWindow As Integer
    Private matWheels As Integer

    Private m_chassis As TVMesh
    Private m_fl As TVMesh
    Private m_fr As TVMesh
    Private m_rl As TVMesh
    Private m_rr As TVMesh
    Private pbi_chassis As Integer
    Private flw As Integer
    Private frw As Integer
    Private rlw As Integer
    Private rrw As Integer
    Private car_ID As Integer
    Private steerAngle As Single

    Private pmatTerrain As Integer
    Private pmatChassis As Integer

    Private Sub InitSound()
        'Add code here
    End Sub

    Private Sub InitGame2DText()
        'Add code here
    End Sub

    Private Sub InitEnvironment()
        'SkyBox
        atmosphere.SkyBox_SetTexture(globals.GetTex("SkyFront"), globals.GetTex("SkyBack"), globals.GetTex("SkyLeft"), globals.GetTex("SkyRight"), globals.GetTex("SkyTop"), globals.GetTex("SkyBottom"))
        atmosphere.SkyBox_Enable(True)
    End Sub

    Private Sub InitFonts()
        'Add code here
    End Sub

    Private Sub InitShaders()
        'Add code here
    End Sub

    Private Sub Init2DText()
        'Add code here
    End Sub

    Private Sub InitLights()
        lights.CreateDirectionalLight(New TV_3DVECTOR(1, -1, -1), 1, 1, 1, "Sun", 1)
        lights.SetLightProperties(globals.GetLight("Sun"), True, True, True)
        lights.SetSpecularLighting(True)
    End Sub

    Private Sub InitPhysics()
        physics.Initialize()
        physics.SetSolverModel(CONST_TV_PHYSICS_SOLVER.TV_SOLVER_EXACT)
        physics.SetFrictionModel(CONST_TV_PHYSICS_FRICTION.TV_FRICTION_EXACT)
        physics.SetGlobalGravity(New TV_3DVECTOR(0, -9.8F, 0))
    End Sub

    Private Sub InitObjects()
        '#Region "Car"
        'Chassis
        m_chassis = scene.CreateMeshBuilder("mChassis")
        m_chassis.LoadTVM("Models\chassis.tvm", False, False)
        m_chassis.SetShadowCast(True, True)
        m_chassis.SetTexture(globals.GetTex("ChassisSTI"), 0)
        m_chassis.SetTextureEx(0, globals.GetTex("Windows"), 1)
        m_chassis.SetTextureEx(1, globals.GetTex("TintedWindows"), 1)
        m_chassis.SetTexture(globals.GetTex("UnderCarriage"), 2)
        m_chassis.SetMaterial(matWindow, 1)
        m_chassis.SetAlphaTest(True, 0, True, 1)
        m_chassis.SetBlendingMode(CONST_TV_BLENDINGMODE.TV_BLEND_ADD, 1)
        m_chassis.SetCullMode(CONST_TV_CULLING.TV_DOUBLESIDED)
        m_chassis.SetShadowCast(True, True)

        'Front Left Wheel
        Dim scale As Single = 1.0F
        m_fl = scene.CreateMeshBuilder("mfl")
        m_fl.LoadTVM("Models\wheel_l.tvm", True, True)
        m_fl.SetScale(scale, scale, scale)
        m_fl.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED)
        m_fl.SetMaterial(matWheels)
        m_fl.SetTexture(globals.GetTex("Wheel"))
        m_fl.SetCullMode(CONST_TV_CULLING.TV_DOUBLESIDED)
        m_fl.SetShadowCast(True, True)

        'Front Right Wheel
        m_rl = scene.CreateMeshBuilder("mrl")
        m_rl.LoadTVM("Models\wheel_l.tvm", True, True)
        m_rl.SetScale(scale, scale, scale)
        m_rl.SetMaterial(matWheels)
        m_rl.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED)
        m_rl.SetTexture(globals.GetTex("Wheel"))
        m_rl.SetCullMode(CONST_TV_CULLING.TV_DOUBLESIDED)
        m_rl.SetShadowCast(True, False)
        m_rl.SetShadowCast(True, True)

        'Rear Left Wheel
        m_fr = scene.CreateMeshBuilder("mfr")
        m_fr.LoadTVM("Models\wheel_r.tvm", True, True)
        m_fr.SetScale(scale, scale, scale)
        m_fr.SetMaterial(matWheels)
        m_fr.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED)
        m_fr.SetTexture(globals.GetTex("Wheel"))
        m_fr.SetCullMode(CONST_TV_CULLING.TV_DOUBLESIDED)
        m_fr.SetShadowCast(True, False)

        'Rear Right Wheel
        m_rr = scene.CreateMeshBuilder("mrr")
        m_rr.LoadTVM("Models\wheel_r.tvm", True, True)
        m_rr.SetScale(scale, scale, scale)
        m_rr.SetMaterial(matWheels)
        m_rr.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED)
        m_rr.SetTexture(globals.GetTex("Wheel"))
        m_rr.SetCullMode(CONST_TV_CULLING.TV_DOUBLESIDED)
        m_rr.SetShadowCast(True, False)
        m_rr.SetShadowCast(True, True)

        m_chassis.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED)
        m_chassis.SetMaterial(matVehicleBody)
        m_chassis.ComputeNormals()
        m_chassis.ComputeBoundings()
        m_chassis.SetScale(scale, scale, scale)
        '#End Region

        'Add The Physics to the chassis
        pbi_chassis = physics.CreateMeshBody(1500, m_chassis, CONST_TV_PHYSICSBODY_BOUNDING.TV_BODY_CONVEXHULL)
        '1500
        physics.SetAutoFreeze(pbi_chassis, False)
        physics.SetBodyPosition(pbi_chassis, 0.0F, 8, 0.0F)
        physics.SetBodyRotation(pbi_chassis, 0.0F, 0.0F, 0.0F)

        'Create The Vehicle
        car_ID = physics.CreateVehicle(pbi_chassis)

        'Do Suspention Settings
        Dim susheight As Single = 0.5F
        'distance from chassis to wheel 0.5f
        Dim susplen As Single = 1.0F
        ' 10
        Dim susshock As Single = 40.0F
        'Springiness of suspension 10
        Dim susspring As Single = 300.0F
        'Stiffness of suspension 400
        flw = physics.AddVehicleWheelEx(car_ID, 25.0F, 0.5F * scale, 0.372F * scale, New TV_3DVECTOR(1, 0, 0), -0.8F * scale, _
         -susheight * scale, 1.25F * scale, 1, 0, 0, susplen, _
         susshock, susspring, m_fl)
        'fl
        frw = physics.AddVehicleWheelEx(car_ID, 25.0F, 0.5F * scale, 0.372F * scale, New TV_3DVECTOR(1, 0, 0), 0.8F * scale, _
         -susheight * scale, 1.25F * scale, 1, 0, 0, susplen, _
         susshock, susspring, m_fr)
        'fr
        rlw = physics.AddVehicleWheelEx(car_ID, 25.0F, 0.5F * scale, 0.372F * scale, New TV_3DVECTOR(1, 0, 0), -0.8F * scale, _
         -susheight * scale, -1.425F * scale, 1, 0, 0, susplen, _
         susshock, susspring, m_rl)
        'rl
        rrw = physics.AddVehicleWheelEx(car_ID, 25.0F, 0.5F * scale, 0.372F * scale, New TV_3DVECTOR(1, 0, 0), 0.8F * scale, _
         -susheight * scale, -1.425F * scale, 1, 0, 0, susplen, _
         susshock, susspring, m_rr)
        'rr
        'Change the car's center of mass / make it drive better
        physics.SetBodyCenterOfMass(car_ID, New TV_3DVECTOR(0, -1.0F, 10.0F))

        'Add wheel frictions
        'Note that this code will also stop sliding on slopes
        Dim sideslip As Single = 0.1F
        Dim sideslipcoef As Single = 0.0F
        Dim maxlongslide As Single = 10000.0F
        Dim maxlongslidecoef As Single = 0.0F
        physics.SetVehicleWheelParameters(car_ID, flw, sideslip, sideslipcoef, maxlongslide, maxlongslidecoef)
        physics.SetVehicleWheelParameters(car_ID, frw, sideslip, sideslipcoef, maxlongslide, maxlongslidecoef)
        physics.SetVehicleWheelParameters(car_ID, rlw, sideslip, sideslipcoef, maxlongslide, maxlongslidecoef)
        physics.SetVehicleWheelParameters(car_ID, rrw, sideslip, sideslipcoef, maxlongslide, maxlongslidecoef)
    End Sub


    Private Sub InitPhysicsMaterials()
        'TerrainLandscape
        pmatTerrain = physics.CreateMaterialGroup("Terrain")
        physics.SetMaterialInteractionFriction(0, pmatTerrain, 0.9F, 1.0F)
        physics.SetMaterialInteractionSoftness(0, pmatTerrain, 1.0F)
        physics.SetMaterialInteractionBounciness(0, pmatTerrain, 0.1F)
        physics.SetBodyMaterialGroup(pbLand, pmatTerrain)

        'Chassis   
        pmatChassis = physics.CreateMaterialGroup("Chassis")
        physics.SetMaterialInteractionFriction(pmatChassis, pmatTerrain, 0.3F, 0.17F)
        physics.SetMaterialInteractionBounciness(pmatChassis, pmatTerrain, 0.1F)
        physics.SetMaterialInteractionSoftness(pmatChassis, pmatTerrain, 1000.0F)
        physics.SetBodyMaterialGroup(pbi_chassis, pmatChassis)
    End Sub

    Private Sub InitMaterials()
        'Create Materials
        matLand = materialfactory.CreateMaterial("land")
        matWindow = materialfactory.CreateMaterial("CarWindows")
        matVehicleBody = materialfactory.CreateMaterial("matVehicleBody")
        matWheels = materialfactory.CreateMaterial("matWheels")

        'Land
        materialfactory.SetSpecular(matLand, 0.1F, 0.1F, 0.1F, 1.0F)

        'Car Windows
        materialfactory.SetAmbient(matWindow, 1, 1, 1, 1)
        materialfactory.SetDiffuse(matWindow, 1, 1, 1, 1)
        materialfactory.SetSpecular(matWindow, 0.8F, 0.8F, 0.8F, 1)
        materialfactory.SetPower(matWindow, 10)
        materialfactory.SetOpacity(matWindow, 1.0F)

       
« Last Edit: August 04, 2011, 08:20:51 PM by Dimple » Logged

Using VB.NET, TV3D 6.5, VISTA
~~~~~~~~~~~~~~~~~~~~~~~

"Know how to ask. There is nothing more difficult for some people, nor for others, easier."

- Baltasar Gracian
Dimple
Community Member
*
Posts: 580


« Reply #2 on: August 04, 2011, 08:13:04 PM »

 Wink
 and now the rest....

Code:
'Vehicle Body
        materialfactory.SetAmbient(matVehicleBody, 0.2F, 0.2F, 0.2F, 1)
        materialfactory.SetDiffuse(matVehicleBody, 0.9F, 0.9F, 0.9F, 1.0F)
        materialfactory.SetSpecular(matVehicleBody, 1.0F, 1.0F, 1.0F, 1)
        materialfactory.SetPower(matVehicleBody, 100)
        materialfactory.SetEmissive(matVehicleBody, 0, 0, 0.1F, 1)

        'Wheels
        materialfactory.SetAmbient(matWheels, 0.8F, 0.8F, 0.8F, 1)
        materialfactory.SetDiffuse(matWheels, 0.2F, 0.2F, 0.2F, 1.0F)
        materialfactory.SetSpecular(matWheels, 0.2F, 0.2F, 0.2F, 1)
        materialfactory.SetPower(matWheels, 200)
        materialfactory.SetEmissive(matWheels, 0.0F, 0.0F, 0, 1)
    End Sub

    Private Sub InitTextures()
        '#Region "Car"
        'Create Very Small Colored Texture For Windows
        Dim i As Integer = texturefactory.CreateTexture(1, 1, True, "TintedWindows")
        texturefactory.SetPixel(i, 0, 0, Color.DarkGray.ToArgb())
        'Color.DarkGray.ToArgb()
        'Vehicle
        texturefactory.LoadTexture("Textures\Windows.bmp", "Windows")
        texturefactory.LoadTexture("Textures\UnderCarriage.bmp", "UnderCarriage")
        texturefactory.LoadTexture("Textures\ChassisSTI.bmp", "ChassisSTI")
        texturefactory.LoadTexture("Textures\Wheel.bmp", "Wheel")
        '#End Region

        'Land
        texturefactory.LoadTexture("Textures\grass.jpg", "Grass")

        'Sky Box
        texturefactory.LoadTexture("Textures\skyup.jpg", "SkyTop")
        texturefactory.LoadTexture("Textures\skydown.jpg", "SkyBottom")
        texturefactory.LoadTexture("Textures\skyleft.jpg", "SkyLeft")
        texturefactory.LoadTexture("Textures\skyright.jpg", "SkyRight")
        texturefactory.LoadTexture("Textures\skyfront.jpg", "SkyFront")
        texturefactory.LoadTexture("Textures\skyback.jpg", "SkyBack")
    End Sub

    Private Sub InitLandscape()
        Land = scene.CreateLandscape("Land")

        Land.SetAffineLevel(CONST_TV_LANDSCAPE_AFFINE.TV_AFFINE_LOW)
        Dim twidth As Integer = (64 * 8) \ 256
        Dim theight As Integer = (64 * 8) \ 256

        Land.GenerateTerrain("Heightmaps\heightmap.bmp", CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_HIGH, twidth, theight, 0, 0, _
         0, True)

        'Land.GenerateTerrain(@"I:\VB\Truevision3d\Projects\Space Time Map Editor\bin\Heightmaps\TestMap.jpg", CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_HIGH, twidth, theight, 0, 0, 0, true);

        'I:\VB\Truevision3d\Projects\Space Time Map Editor\bin\Heightmaps\TestMap.jpg

        Land.SetTexture(globals.GetTex("Grass"))
        Land.SetMaterial(matLand)
        Land.SetTextureScale(10, 10)
        Land.SetPosition(-((twidth * 256) \ 2), 0, -((theight * 256) \ 2))

        pbLand = physics.CreateStaticTerrainBody(Land)
    End Sub

    Private Sub GameLoop()
        While bDoLoop
            If Me.Focused Then
                physics.Simulate(tv.TimeElapsed() * 0.0025F)
                CheckInput()

                tv.Clear(False)

                'Render Atmosphere
                atmosphere.SkyBox_Render()

                'Render Objets
                Land.Render()
                m_chassis.Render()
                m_fl.Render()
                m_fr.Render()
                m_rl.Render()
                m_rr.Render()
                'Render Transparent Objects

                scene.FinalizeShadows()

                'Lastly Render 2DText or Interface
                DrawInterface()

                tv.RenderToScreen()
            Else
                System.Threading.Thread.Sleep(100)
            End If

            Application.DoEvents()
        End While
    End Sub

    Private Sub DrawInterface()

        'Add Code Here
        Try
        Catch
        End Try
    End Sub

    Private Sub CheckInput()
        If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_ESCAPE) Then
            bDoLoop = False
        End If
        Dim speed As Single = 1.0F
        Dim mousespeed As Single = 0.1F

        ' Camera Movement
        If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_W) Then
            camera.MoveRelative(speed, 0, 0, True)
        End If
        If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_S) Then
            camera.MoveRelative(-speed, 0, 0, True)
        End If
        If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_A) Then
            camera.MoveRelative(0, 0, -speed, True)
        End If
        If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_D) Then
            camera.MoveRelative(0, 0, speed, True)
        End If
        If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_E) Then
            camera.MoveRelative(0, speed / 2, 0, True)
        End If
        If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_Q) Then
            camera.MoveRelative(0, -(speed / 2), 0, True)
        End If

        'Accelerate and Brake
        Dim CarPower As Single = 3000
        '3000
        ' UpArrow = Forward
        If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_UPARROW) Then
            'Accellerate
            'physics.SetVehicleWheelTorque(car_ID, rlw, CarPower, -1000)
            'physics.SetVehicleWheelTorque(car_ID, rrw, CarPower, -1000)
            physics.SetVehicleWheelTorque(car_ID, rlw, CarPower, -100)
            physics.SetVehicleWheelTorque(car_ID, rrw, CarPower, -100)
        Else
            '  DownArrow = Reverse
            If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_DOWNARROW) Then
                'physics.SetVehicleWheelTorque(car_ID, rlw, -CarPower, -1000)
                'physics.SetVehicleWheelTorque(car_ID, rrw, -CarPower, -1000)
                physics.SetVehicleWheelTorque(car_ID, rlw, -CarPower, -100)
                physics.SetVehicleWheelTorque(car_ID, rrw, -CarPower, -100)
            Else
                'physics.SetVehicleWheelTorque(car_ID, flw, 0, -10000)
                'physics.SetVehicleWheelTorque(car_ID, frw, 0, -10000)
                'physics.SetVehicleWheelTorque(car_ID, rlw, 0, -10000)
                'physics.SetVehicleWheelTorque(car_ID, rrw, 0, -10000)
                physics.SetVehicleWheelTorque(car_ID, flw, 0, -5000)
                physics.SetVehicleWheelTorque(car_ID, frw, 0, -5000)
                physics.SetVehicleWheelTorque(car_ID, rlw, 0, -5000)
                physics.SetVehicleWheelTorque(car_ID, rrw, 0, -5000)
            End If
        End If

        'Steering
        If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_LEFTARROW) Then
            steerAngle -= 10
            If steerAngle < -45 Then
                steerAngle = -45
            End If

            'If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_LEFTARROW) Then
            '    steerAngle += 10
            '    If steerAngle > 45 Then
            '        steerAngle = 45
            '    End If

            physics.SetVehicleWheelSteering(car_ID, flw, steerAngle)
            physics.SetVehicleWheelSteering(car_ID, frw, steerAngle)
        Else
            If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_RIGHTARROW) Then
                steerAngle += 10
                If steerAngle > 45 Then
                    steerAngle = 45
                End If

                'If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_RIGHTARROW) Then
                '    steerAngle -= 10
                '    If steerAngle < -45 Then
                '        steerAngle = 45
                '    End If

                physics.SetVehicleWheelSteering(car_ID, flw, steerAngle)
                physics.SetVehicleWheelSteering(car_ID, frw, steerAngle)
            Else
                steerAngle = 0

                physics.SetVehicleWheelSteering(car_ID, flw, steerAngle)
                physics.SetVehicleWheelSteering(car_ID, frw, steerAngle)
            End If
        End If

        'Car Handbrake Right or Left Control Keys
        If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_RIGHTCONTROL) Then
            'physics.VehicleWheelHandBrake(car_ID, rlw, 1, 2000)
            'physics.VehicleWheelHandBrake(car_ID, rrw, 1, 2000)
            physics.VehicleWheelHandBrake(car_ID, rlw, 1, 2500)
            physics.VehicleWheelHandBrake(car_ID, rrw, 1, 2500)
        End If

        If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_LEFTCONTROL) Then
            'physics.VehicleWheelHandBrake(car_ID, rlw, 1, 2000)
            'physics.VehicleWheelHandBrake(car_ID, rrw, 1, 2000)
            physics.VehicleWheelHandBrake(car_ID, rlw, 1, 2500)
            physics.VehicleWheelHandBrake(car_ID, rrw, 1, 2500)
        End If

        ' Pressing P makes the car hop!
        If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_P) Then
            physics.VehicleReset(car_ID)
            physics.SetBodyRotation(pbi_chassis, 0, 0, 0)
            physics.SetBodyPosition(pbi_chassis, physics.GetBodyPosition(pbi_chassis).x, physics.GetBodyPosition(pbi_chassis).y + 0.2F, physics.GetBodyPosition(pbi_chassis).z)
        End If
        ' Pressing O makes the car hover in the Air!(Hmm, Start position?)
        If input.IsKeyPressed(CONST_TV_KEY.TV_KEY_O) Then
            physics.VehicleReset(car_ID)
            physics.SetBodyPosition(pbi_chassis, 0.0F, 5, 0.0F)
            physics.SetBodyRotation(pbi_chassis, 0.0F, 0.0F, 0.0F)
        End If



        'Mouse
        Dim tmpMouseX As Integer = 0
        Dim tmpMouseY As Integer = 0
        Dim tmpMouseScrollNew As Integer = 0
        Dim tmpMouseB1 As Boolean = False
        Dim tmpMouseB2 As Boolean = False
        Dim tmpMouseB3 As Boolean = False
        Dim tmpMouseB4 As Boolean = False

        input.GetMouseState(tmpMouseX, tmpMouseY, tmpMouseB1, tmpMouseB2, tmpMouseB3, tmpMouseB4, _
         tmpMouseScrollNew)
        camera.RotateY(tmpMouseX * (mousespeed * 2))
        camera.SetLookAt(camera.GetLookAt().x, camera.GetLookAt().y - (tmpMouseY * ((mousespeed * 2) / 100)), camera.GetLookAt().z)

    End Sub

    Private Sub frmCanvas_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs)
        bDoLoop = False
    End Sub

    Private Sub frmCanvas_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        lights = New TVLightEngine()
        globals = New TVGlobals()
        atmosphere = New TVAtmosphere()
        maths = New TVMathLibrary()
        materialfactory = New TVMaterialFactory()
        texturefactory = New TVTextureFactory()
        tv = New TVEngine()
        physics = New TVPhysics()

        'Setup TV
        tv.SetDebugMode(True, True)
        tv.SetDebugFile(System.IO.Path.GetDirectoryName(Application.ExecutablePath) & "\debugfile.txt")
        tv.SetAntialiasing(True, CONST_TV_MULTISAMPLE_TYPE.TV_MULTISAMPLE_2_SAMPLES)

        'Enter Your Beta Username And Password Here
        'tv.SetBetaKey("", ""); //NO Longer Required

        tv.SetAngleSystem(CONST_TV_ANGLE.TV_ANGLE_DEGREE)
        tv.Init3DWindowed(Me.Handle, True)
        tv.GetViewport().SetAutoResize(True)
        tv.DisplayFPS(True)
        tv.SetVSync(True)

        scene = New TVScene()

        input = New TVInputEngine()
        input.Initialize(True, True)

        camera = New TVCamera()
        camera = scene.GetCamera()
        camera.SetViewFrustum(45, 1000, 0.1F)
        camera.SetPosition(0, 5, -20)
        camera.SetLookAt(0, 3, 0)

        viewport = New TVViewport()
        viewport = tv.CreateViewport(Me.Handle, "viewport")
        viewport.SetCamera(camera)
        viewport.SetBackgroundColor(Color.Blue.ToArgb())
        bDoLoop = True


        InitSound()

        InitMaterials()

        InitTextures()

        InitFonts()

        InitShaders()

        InitEnvironment()

        InitPhysics()

        InitLandscape()

        InitObjects()

        InitLights()

        InitPhysicsMaterials()

        Init2DText()

        Me.Show()
        Me.Focus()

        GameLoop()

        tv = Nothing

        Me.Close()
    End Sub
End Class
« Last Edit: August 04, 2011, 08:17:27 PM by Dimple » Logged

Using VB.NET, TV3D 6.5, VISTA
~~~~~~~~~~~~~~~~~~~~~~~

"Know how to ask. There is nothing more difficult for some people, nor for others, easier."

- Baltasar Gracian
TripleView
Community Member
*
Posts: 32


« Reply #3 on: August 05, 2011, 12:02:34 PM »

I saw that code, basically what the problem was.... was me being tired. There was a stray vert on the model sticking below the car that for whatever reason was tossing the center of the vehicle body off so the tires got started with the wrong rotations.
Logged
TripleView
Community Member
*
Posts: 32


« Reply #4 on: August 05, 2011, 01:48:04 PM »

Still have problems though


moving the wheels to where they need to be messes up the rest of physics on everything. Leaving them alone and the tires don't align with the wheel wells at all.
Either newton is screwed totally, TV doesn't allow you to make the correct adjustments using newton or more then likely I have done something wrong.
Logged
Dimple
Community Member
*
Posts: 580


« Reply #5 on: August 05, 2011, 09:13:25 PM »

 Smiley

Can you show(post)the code you are using for the wheel setup. To look at and compare to the listed code?

 
Logged

Using VB.NET, TV3D 6.5, VISTA
~~~~~~~~~~~~~~~~~~~~~~~

"Know how to ask. There is nothing more difficult for some people, nor for others, easier."

- Baltasar Gracian
TripleView
Community Member
*
Posts: 32


« Reply #6 on: August 06, 2011, 08:28:41 AM »

Code:
'Left Front
DevCar1.WheelID(0) = Physics.AddVehicleWheelEx(DevCar1.VehicleID, 25, 0.5 * DevCar1.sScale, 0.372 * DevCar1.sScale, TV3DVector(0.1, 0, 0), -0.8 * DevCar1.sScale, -DevCar1.sHeight * DevCar1.sScale, 1 * DevCar1.sScale, 1, 0, 0, DevCar1.sLength, DevCar1.sShock, DevCar1.sSpring, DevCar1.Wheel(2))
'Right Front
DevCar1.WheelID(1) = Physics.AddVehicleWheelEx(DevCar1.VehicleID, 25, 0.5 * DevCar1.sScale, 0.372 * DevCar1.sScale, TV3DVector(0.1, 0, 0), 0.8 * DevCar1.sScale, -DevCar1.sHeight * DevCar1.sScale, 1 * DevCar1.sScale, 1, 0, 0, DevCar1.sLength, DevCar1.sShock, DevCar1.sSpring, DevCar1.Wheel(0))
'Left Rear
DevCar1.WheelID(2) = Physics.AddVehicleWheelEx(DevCar1.VehicleID, 25, 0.5 * DevCar1.sScale, 0.372 * DevCar1.sScale, TV3DVector(0.1, 0, 0), -0.8 * DevCar1.sScale, -DevCar1.sHeight * DevCar1.sScale, -2.34 * DevCar1.sScale, 1, 0, 0, DevCar1.sLength, DevCar1.sShock, DevCar1.sSpring, DevCar1.Wheel(3))
'Right Rear
DevCar1.WheelID(3) = Physics.AddVehicleWheelEx(DevCar1.VehicleID, 25, 0.5 * DevCar1.sScale, 0.372 * DevCar1.sScale, TV3DVector(0.1, 0, 0), 0.8 * DevCar1.sScale, -DevCar1.sHeight * DevCar1.sScale, -2.34 * DevCar1.sScale, 1, 0, 0, DevCar1.sLength, DevCar1.sShock, DevCar1.sSpring, DevCar1.Wheel(1))

This is the code I am using to attach the wheels to the vehicle body. Everything looks good. The wheels are in the right spot but it sticks to the ground no matter what when you drive it does not slide at all like it should in this video
http://www.youtube.com/watch?v=pykA2SO8JlA
& it looks like this

Now if I just load up the car with the EXACT same code as the youtube video with just a different model
the wheel line up like this:

and it drives fine but the wheels don't align right.

This is a pic of the red car (the one with the selected verts & the base of the car used in the youtube video)

They match perfectly but when I load it up into TV the tires screw up.

So basically if I change the local position of the wheels then the car does not drive right. The only time I get any sliding at all is when the car hits a bump. I am totally stumped.

here is a link to the model
http://www.zshare.net/download/93390946228c8c24/

Exporting the mesh as a .x file and trying to load it gives me this in the debug file
"The X parser had a problem, please check the X file structure, error -2005531760"
« Last Edit: August 06, 2011, 09:55:59 AM by TripleView » Logged
Dimple
Community Member
*
Posts: 580


« Reply #7 on: August 06, 2011, 08:14:56 PM »

 Huh

Drat, I can't download from there. I get a (This domain is blocked.).  Do you have or can use a MediaFire account?  http://www.mediafire.com/  I'll look at your code but it does look like it's a model problem wha happens if you size the wheel/tire to a little smaller size?  just a thought.




Logged

Using VB.NET, TV3D 6.5, VISTA
~~~~~~~~~~~~~~~~~~~~~~~

"Know how to ask. There is nothing more difficult for some people, nor for others, easier."

- Baltasar Gracian
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks