Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 30 Jan 2009
Offline Last Active Feb 21 2013 12:14 AM

Topics I've Started

Unity c# scripting acsessing components and understanding the hierarchy

19 February 2013 - 09:16 AM

I'm using unity combined with c# but I'm having trouble with navigating the hierarchy from within my scripts to get access to specific components.


For example my hierarchy looks like this:








   Main Camera



Box02 got a component in which needs access to the camera component in the Main Camera. 


I've figured that what I need to do should be to somehow navigate to the Main Camera gameObject and then use the getComponent function but I'm not sure how to do it. I tried getting to the Ship gameObject by using transform.parent but that didn't seem to work.


I've been trying to find a good resource which explains this but I cant find one.



I finally found something that helped me.




The first answer here helped my immensely so if anyone else runs in to similar trouble then go here.

Fragmenting a mesh using csg operations

27 January 2013 - 11:36 AM

HI I'm considering different ways to implementing mesh fragmentation. One example would be fracture in the unreal engine. I've found a few interesting reads about this using vornoi.





One approach was intersecting the object with a plane, displace a few vertexes on the plane and cut the mesh using it. Creating multiple planes and rotating them would resulting in several fragments.


I'm not very well traversed in graphics but I also came upon constructive solid geometry and figured that using intersection operations could result in a fragmented mesh.


I was something something along the lines that first you separate all/some of the faces of the mesh from each other or rather create copies of these. Then you extrude these inwards. Then using different CSG operations you create the fragments using intersection operations and kinda carve out the original mesh. And to avoid too much fragmentation you only carve from the original and not the fragments so that even if the extruded faces would overlap at times this would not result in extra fragmentation.


I'm curious if this could work? One problem I foresee is if you have a rectangle mesh it wouldn't produce very interesting results but if you subdivided the mesh first and then pick the order of faces to intersect at random it could produce better results.




Swapping data between two vectors

25 October 2012 - 02:23 AM

I'm curios about swapping data between two vectors and what will happen in the following code.
Will the switch affect both vectors or just the one calling swap()?

std::vector<bool>::iterator i;
std::vector<bool>::iterator j;

j = b.begin();

for(i = a.begin();i != a.end();i++)

Quirky neural network AI

24 October 2012 - 02:47 PM

I'm trying to teach a neural network to play pong and so far it's not going very well. I'm using supervised training where I play against myself and every time I move the pad that the AI is going to use I save away some data and when I decide I've gathered enough data I use that for the training.

The data I save away is the balls x,y position as well as ball direction x and y. The y position of the pad. This is what I use for input.
If the pad moves up then I set target outputs for the two output neurons to 1 and 0 and if I move down I set it to 0 and 1.

Its a feed forward network and so far the best results has been that if the ball is moving downwards the AI moves downwards and the ball goes upwards the pad moves upwards. But it wont take in consideration of the balls current position meaning that the pad moves either towards the bottom or the top of the screen.

Bug with c++ code sections

23 October 2012 - 08:38 AM

There seems to be a bug when you add cpp code to a post.

All code after << disappears.

Noticed this after two sections of code I posted when blank. First after std::cout<<"whatever" and std::cerr<<"sumtingwong".

Both sections just showed std::cout and std::cerr and all subsequent code went missing.


[source lang="cpp"]std::cout<<"Rawr"<<std::endl;[/source]

inside my source tags I wrote std::cout<<"Rawr"<<std::endl; but only the first was there

Another example:

[source lang="cpp"]Trollol << wrong[/source]

Here I wrote Trollol << wrong