Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed May 02, 2013 at 05:14 AM by Loius for the following reason:

Duplicate Question

avatar image
1
Question by fenix_fx · Feb 14, 2012 at 11:12 PM · androiderrorobject

BCE0019: 'position' is not a member of 'Object'

 129# function NavigateTowardsWaypoint () {
 130# var RelativeWaypointPosition : Vector3 = transform.InverseTransformPoint( Vector3( 
 131#                                          waypoints[currentWaypoint].ToString.position.x, 
 132#                                          transform.position.y,
 133#                                          waypoints[currentWaypoint].position.z ) );

i'm truing to build android project but in console 2 errors "Assets/Scripts/Car Control/AICar_Script.js(131,124): BCE0019: 'position' is not a member of 'Object'.

Assets/Scripts/Car Control/AICar_Script.js(133,124): BCE0019: 'position' is not a member of 'Object'." i don't know how fix it >.< help plz!

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Klaudia · Sep 27, 2012 at 04:27 PM 0
Share

Hi,I have a problem with the same error (BCE0019: 'position' is not a member of 'Object'), but I don't have .ToString in my code. Please help.

 function NavigateTowardsWaypoint () {
 var RelativeWaypointPosition : Vector3 = transform.InverseTransformPoint( Vector3( 
                                          waypoints[currentWaypoint].position.x, 
                                          transform.position.y, 
                                          waypoints[currentWaypoint].position.z ) );
avatar image Bunny83 · Sep 27, 2012 at 04:38 PM 0
Share

@$$anonymous$$laudia: Your post doesn't answer the question, so don't post it as answer. This is a Q&A site, not a forum. I've converted your "answer" into a comment.

4 Replies

  • Sort: 
avatar image
2
Best Answer

Answer by DaveA · Feb 14, 2012 at 11:19 PM

 .ToString.position.x

Get rid of .ToString

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image harschell · May 02, 2013 at 05:29 AM 0
Share

when used above it Says, " 'position' is not a member of 'function(): String'. "

avatar image
1

Answer by Bunny83 · Sep 27, 2012 at 04:37 PM

The problem is probably because your waypoints array (or what ever it is) isn't typed. You probably used the Array class which is really bad ;) We can only guess how this array is declared so it's impossible to straight-forward answer this.

Dave is of course right, the ToString doesn't make any sense here.

The waypoints variable should look either like this:

 var waypoints : Transform[];

or

 var waypoints : List.<Transform>;

In the second case you need to import the System.Collections.Generic namespace at the top

 import System.Collections.Generic;

If it still doesn't work there's not much we can say about this without more information.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Zerey · Dec 11, 2014 at 01:14 AM 0
Share

this variable is re-writing

function GetWaypoints () {

  var potentialWaypoints : Array = waypointContainer.GetComponentsInChildren( Transform );
  waypoints = new Array(potentialWaypoints);
  
  for ( var potentialWaypoint : Transform in potentialWaypoints ) {
      if ( potentialWaypoint != waypointContainer.transform ) {
          waypoints[ waypoints.length-1 ] = potentialWaypoint;
      }
  }

}

avatar image
1

Answer by harschell · May 02, 2013 at 05:09 AM

@ fenix_fx

Use private var waypoints : Transform[]; instead private var waypoints : Array; :)

@javanoob Do accept the Answer if its Helpful :) =)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by javanoob · Dec 22, 2012 at 07:42 PM

 var FrontLeftWheel : WheelCollider;
 var FrontRightWheel : WheelCollider;
    
 var GearRatio : float[];
 var CurrentGear : int = 0;
 
 var EngineTorque : float = 600.0;
 var MaxEngineRPM : float = 3000.0;
 var MinEngineRPM : float = 1000.0;
 private var EngineRPM : float = 0.0;
 
 var waypointContainer : GameObject;
 private var waypoints : Array;
 private var currentWaypoint : int = 0;
 
 private var inputSteer : float = 0.0;
 private var inputTorque : float = 0.0;
 
 function Start () {
     rigidbody.centerOfMass.y = -1.5;
     GetWaypoints();
 }
 
 function Update () {
     
     rigidbody.drag = rigidbody.velocity.magnitude / 250;
     
     // Call the funtion to determine the desired input values for the car. This essentially steers and
     // applies gas to the engine.
     NavigateTowardsWaypoint();
     
     // Compute the engine RPM based on the average RPM of the two wheels, then call the shift gear function
     EngineRPM = (FrontLeftWheel.rpm + FrontRightWheel.rpm)/2 * GearRatio[CurrentGear];
     ShiftGears();
 
     // set the audio pitch to the percentage of RPM to the maximum RPM plus one, this makes the sound play
     // up to twice it's pitch, where it will suddenly drop when it switches gears.
     audio.pitch = Mathf.Abs(EngineRPM / MaxEngineRPM) + 1.0 ;
     // this line is just to ensure that the pitch does not reach a value higher than is desired.
     if ( audio.pitch > 2.0 ) {
         audio.pitch = 2.0;
     }
     
     // finally, apply the values to the wheels.    The torque applied is divided by the current gear, and
     // multiplied by the calculated AI input variable.
     FrontLeftWheel.motorTorque = EngineTorque / GearRatio[CurrentGear] * inputTorque;
     FrontRightWheel.motorTorque = EngineTorque / GearRatio[CurrentGear] * inputTorque;
         
     // the steer angle is an arbitrary value multiplied by the calculated AI input.
     FrontLeftWheel.steerAngle = 10 * inputSteer;
     FrontRightWheel.steerAngle = 10 * inputSteer;
 }
 
 function ShiftGears() {
     // this funciton shifts the gears of the vehcile, it loops through all the gears, checking which will make
     // the engine RPM fall within the desired range. The gear is then set to this "appropriate" value.
     if ( EngineRPM >= MaxEngineRPM ) {
         var AppropriateGear : int = CurrentGear;
         
         for ( var i = 0; i < GearRatio.length; i ++ ) {
             if ( FrontLeftWheel.rpm * GearRatio[i] < MaxEngineRPM ) {
                 AppropriateGear = i;
                 break;
             }
         }
         
         CurrentGear = AppropriateGear;
     }
     
     if ( EngineRPM <= MinEngineRPM ) {
         AppropriateGear = CurrentGear;
         
         for ( var j = GearRatio.length-1; j >= 0; j -- ) {
             if ( FrontLeftWheel.rpm * GearRatio[j] > MinEngineRPM ) {
                 AppropriateGear = j;
                 break;
             }
         }
         
         CurrentGear = AppropriateGear;
     }
 }
 
 function GetWaypoints () {
     // Now, this function basically takes the container object for the waypoints, then finds all of the transforms in it,
     // once it has the transforms, it checks to make sure it's not the container, and adds them to the array of waypoints.
     var potentialWaypoints : Array = waypointContainer.GetComponentsInChildren( Transform );
     waypoints = new Array();
     
     for ( var potentialWaypoint : Transform in potentialWaypoints ) {
         if ( potentialWaypoint != waypointContainer.transform ) {
             waypoints[ waypoints.length ] = potentialWaypoint;
         }
     }
 }
 
 function NavigateTowardsWaypoint () {
     // now we just find the relative position of the waypoint from the car transform,
     // that way we can determine how far to the left and right the waypoint is.
     var RelativeWaypointPosition : Vector3 = transform.InverseTransformPoint( Vector3( 
                                                 waypoints[currentWaypoint].position.x, 
                                                 transform.position.y, 
                                                 waypoints[currentWaypoint].position.z ) );
                                                                                 
                                                                                 
     // by dividing the horizontal position by the magnitude, we get a decimal percentage of the turn angle that we can use to drive the wheels
     inputSteer = RelativeWaypointPosition.x / RelativeWaypointPosition.magnitude;
     
     // now we do the same for torque, but make sure that it doesn't apply any engine torque when going around a sharp turn...
     if ( Mathf.Abs( inputSteer ) < 0.5 ) {
         inputTorque = RelativeWaypointPosition.z / RelativeWaypointPosition.magnitude - Mathf.Abs( inputSteer );
     }else{
         inputTorque = 0.0;
     }
     
     // this just checks if the car's position is near enough to a waypoint to count as passing it, if it is, then change the target waypoint to the
     // next in the list.
     if ( RelativeWaypointPosition.magnitude < 20 ) {
         currentWaypoint ++;
         
         if ( currentWaypoint >= waypoints.length ) {
             currentWaypoint = 0;
         }
     }
     
 }


Hey ,this is the complete Gotow AI script ,when converted to Android I get this error ,anyone have a clue please ?

Assets/Scripts/Car Control/AICar_Script.js(131,124): BCE0019: 'position' is not a member of 'Object'. (sorry to post as answer but the comment wouldnt allow me to paste code ??)

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Noxury · Apr 02, 2015 at 07:39 PM 0
Share

oh. Yeah, I have that problem too. Have you fixed it already? (this code contains 128 lines but your console has printed 131 line. I think line 101-103 is the right location)

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Change 3D Object by pressing Gui Button 1 Answer

Script stops working when switching to Android 1 Answer

Can't Add Script 1 Answer

Send an activity from C# to Java 0 Answers

Help!, Android plataform SCRIPT? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges