Does SceneKit have something like the SKCropNode? - ios

I want to do a Boolean Intersection between two SCNNodes. I remember that when I use SpriteKit, there is something called the SKCropNode which allows me to show only a part of its childNodes. I'm wondering whether SceneKit has the same thing? Thanks a lot.
(If you are quite familiar with SceneKit and you've never heard about something like that, please just reply NO, thanks.)

Related

SCNLight cast shadow in all direction

Suppose we have a room where the lamp is right in the middle of the room, both vertically and horizontally. How can it cast shadows in all directions? Is there anyway to fake it? I have objects that move. SCNLightTypeSpot can cast shadows in a cone, but that doesn't work in this situation.
Your best bet it to have multiple lights.
As Toyos said, a light that shines in every direction is an omni light, but considering the shadow rendering technique used (pretty much, a camera).
If you are comfortable with OpenGL, you could implement it easily. There a re resources online on how to approach it such as this GPUGems article about cubemaps or this more recent paper for a new technique using paraboloids.
You could also suggest these to Apple engineers using the bug reporter! I'm sure a lot of games and applications would benefit from Omnidirectional shadows.
What you would need is an omni light that supports casting shadows. As the documentation of "castsShadows" says, this is currently not supported by omni lights. You should file a bug request to Apple.

Slingshot action (movement) without cocos-2d

I want to create a game in which the sling shot will be used like in angry birds or sling shot game. I want to ask can is this possible to make the slingshot action like it throws at object in the angle with out cocos-2d. Please help me how should I proceed with this because I do not much on cocos 2d.
Thanks in advance.
I think you must make a method which will find the points to make a path from initial point to end point.
for that you need to use some dynamics concept.
after that you can implement animation of view along "path".How would I implement animation along a path using the iPhone SDK?
Hope this help
I think you should just go with buying this starter kit if you want to avoid deep dig into cocos2D.
It's got good dynamic features with lots of documentation.
You can UIView animation alternative of Cocos2d

Stretching a UIImage across the length of a UIBezierPath

What I basically need to achieve is a Fruit Ninja - style "slash" effect, where the "slash" trails the user's touch and follows the shape of the user's gesture, and is thinner the longer the distance the user has swiped.
The simplest way to achieve this seemed to be to collect all the points the user passes through in a UIBezierPath, and "stretch" an image through the length of the BezierPath. This would achieve the kind of "trailing" effect I was looking for and also ensure that the line is thinner if the distance travelled is longer.
However I can't seem to find a way to actually implement this. Is this even possible?
Alternatives? Thanks.
P.S: This is for a low-medium priority section of a regular app and not a game, so I would like to avoid having go down to OpenGL and spend a lot of time to achieve this (with completely custom drawing, etc). Something at the SDK level would be preferred, and if that's not possible at all, we'll just figure out a different UI.
Thanks!
For pretty easy-to-use stretching teqhniques of images/views you could look into
https://github.com/hfossli/AGGeometryKit/
I recommend trying to draw using CoreGraphics. See this link
http://www.effectiveui.com/blog/2011/12/02/how-to-build-a-simple-painting-app-for-ios/
Okay. Maybe you can use this.
https://github.com/hfossli/AGDraw
Just something I wrote a while ago. Hit clear and try to draw something (clear will toggle between two types of strokes). You'll see the width of the penstroke will increase with the velocity you use.. I guess that fits your need. If you fix some bugs, please make a pull request. You are free to use the code, but I will add a MIT license later.

three.js - create draggable circle

I've just cloned the three.js project from github. I'm interested in creating a circle on a 2d plane that I can drag with my mouse. I have no experience in graphics programming (WebGL or OpenGL).
Can someone please point me in the right direction? I've tried google, but the examples seem too complicated.
Many thanks in advance,
I think this is something you need to have a go at. It's not nearly as complicated as you might think. If the maths are scaring you off, don't worry three.js handles it all for you, you just need to add a camera, some shapes and ask it to render them.
Please do take the time to go through aerotwists three js tutorials as these will give you a good grounding in how to setup a basic scene.
You will quickly realise that once you have a scene you can change objects quite easily using your current scene.
As for dragging things around, I'm sure that will come just try to walk before you can run.

How should I do this (Game)?

Right now I have coded about 80% of my game and the remaining 20% is the actual game part of it. I need to know how I should go upon actually making the game part.
Pretty much it will be somewhat similar to Doodle Jump. There will be gravity, the accelerometer, and a spawn system for platforms. I need to know if I should use UIKit or Cocos2D for this.
I know I can do gravity and use the accelerometer easily using UIKit but I am worried about the platform part. My 'Doodle Jump character' is not a regular square or rectangle so should I just crop it as best I can? The reason I am worried is because say the character falls on a platform, so his body could be a little off since CGRectIntersectsRect does not have pixel collision detection, so do you think it is fine the way it is?
If you need more info or aren't sure what I am trying to do, just let me know. In the end I just need to know if I should use Cocos2D or UIKit.
Please let me know your thoughts.
Thanks!
My answer would be that, while you may be able to develop the game in UIKit, my suspiction is that it will be better in the long run to do it in Cocos2D. Not only will you have tools which are better for doing stuff like collision detection, you can also use a Physics Engine to handle the gravity and things like that. Basically, Cocos2d was made to do exactly the kinds of things you want to do, and UIKit wasn't...it was made for user interfaces.
Still, the collision detection you do will, mostly likely, not need to be down the level of individual pixels. One rectangle might be enough, or perhaps you can use several to get more accuracy. So can you pull it off in UIKit...maybe, but I bet your game will turnout better overall if you use Cocos2d.

Resources