- Home /
Want to use iTween for 2d floor collision.
Hey Guys, I'm making a simple 2d side scrolling game. When I say 2d I mean it will appear 2d, all background assets will be 2d but the main character will be 3d. What I want is an uneven floor surface. There will be no actual floor only what appears on the background, so technically i want to fake the floor collision.
I've looked into iTween and this looks like it could do what I want. My idea was to use iTween to create a line matching that of the floor on the background. I would then match the main characters x position with the lines x position and then get the lines y position at this point to set the characters y position.
My only problem is that I can't seem to get coordinates of the line. There is a method in iTween called PointOnPath()
but in order to get the coordinates i need to know how far along the line my character is by a percentage. This is something I do not know as my character is not actually following the line.
If anyone has any ideas on how I could accomplish this, with or without using iTween, it would be greatly appreciated.
Thanks in advance,
John
Answer by felixwcf85 · Jan 26, 2013 at 06:22 AM
When iTween is enabled, Collision will NOT working. Becasue the collider's isKinematic is turned off by iTween when it is called.
You can use Raycasting to detect whether the collision of two object is happening, and use iTween.Stop(gameObject target) to stop the iTween.
Your answer
Follow this Question
Related Questions
2D Detect collisions of a 2D block only on left/right (not top/bottom) 0 Answers
Ignore collision at high velocity. 1 Answer
Change shape of object upon collision 1 Answer
Colliders in a wall jut out 0 Answers
Collision & 2D 2 Answers