A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by blackbird_dream » Fri Feb 16, 2018 11:16 am
I don't understand the meaning of the instruction :
- Code: Select all
if (m_world) {...
-
blackbird_dream
-
- Posts: 354
- Joined: Wed Jun 07, 2006 3:08 pm
- Location: France
by Sweenie » Fri Feb 16, 2018 2:42 pm
Cant remember where that is used but what it does is verifying that variable m_world isn't null.
It's good practice to check for null values. Maybe not too important in c# since you usually just get an exception.
-
Sweenie
-
- Posts: 498
- Joined: Mon Jan 24, 2005 7:59 am
- Location: Sweden
by blackbird_dream » Mon Feb 19, 2018 3:30 am
it's the script of the example.
In the scene One NewtonWorld already exists named 'World'
In the script another NewtonWorld variable is created (in the class RayCaster).
So 2 Newtonworlds are coexisting in the same scene ?
-
blackbird_dream
-
- Posts: 354
- Joined: Wed Jun 07, 2006 3:08 pm
- Location: France
by Sweenie » Mon Feb 19, 2018 12:36 pm
Ah, now i remember. Im not creating two worlds. The raycaster script just wants a reference to a newton world which i expose as a reference variable in the script. The code you mentioned simply checks that the reference is set. The plugin is designed to handle multiple worlds so the raycast script must know what world to raycast against.
-
Sweenie
-
- Posts: 498
- Joined: Mon Jan 24, 2005 7:59 am
- Location: Sweden
by blackbird_dream » Tue Feb 20, 2018 3:18 am
That's what I suspected indeed, but it's not clear in my mind the relation between the reference variable and the global variable, I mean how practically it works. I don't need to know to use it but I can't stop trying to understand.
-
blackbird_dream
-
- Posts: 354
- Joined: Wed Jun 07, 2006 3:08 pm
- Location: France
by blackbird_dream » Thu Feb 22, 2018 9:06 am
ah ok
I understand the meaning of 'expose'. The pb in my case is I'm using properties exposed through the Editor . So I need to declare the NewtonWorld as a SerializedProperty in the editor script I suppose ?
How to implement the popup list to select the NewtonWorld in the EDI ?
I've had a look at NewtonBody.cs but there is no Editor script associated with it so I's just declared like in Raycaster.cs
-
blackbird_dream
-
- Posts: 354
- Joined: Wed Jun 07, 2006 3:08 pm
- Location: France
by blackbird_dream » Thu Feb 22, 2018 10:00 am
oh yes I got it from Newtoncollider.cs
EditorGUILayout.PropertyField(m_monde, new GUIContent("NewtonWorld"));
-
blackbird_dream
-
- Posts: 354
- Joined: Wed Jun 07, 2006 3:08 pm
- Location: France
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 6 guests