I'm trying to create trace effect to ball shape SKNode, I can try with EmitterNode, but it creates like particle effect, I need help creating an effect similar to the attached screen below, please help how I can create.
This is known as a trail effect. Sometimes the result of motion blur, we're conditioned to know well through slow shutter speeds in 24fps movies.
Here's a github repo that creates something very similar:
https://github.com/dionlarson/Duet-Trail-Effect-SpriteKit-Playground
Related
I found out that adding SCNNodes (with SCNGeometry) to the scene causes a severe lag spike.
According to the Time Profiler it has to generate the geometry (at least the functions/methods are called like that). It does that at the time when the node is added to the scene, not when the node is created. Hence, creating a pool with SCNNodes will not work.
Is there a way to get rid of this lag? I'd like to be able to add nodes to the scene without any FPS drop.
The only idea I have so far is adding everything to the scene already and then hiding / un-hiding it, though this is not really a clean solution.
Here's a shot from Time Profiler:
looks like your are adding a node with an SCNShape or SCNText attached to it and these kinds of geometries are expensive to create (you have to discretize and triangulate the Bézier curve, and eventually have to compute and offset curve for the chamfer).
You can try to preload the following methods from SCNSceneRenderer : -prepareObject:shouldAbortBlock:, -prepareObjects:withCompletionHandler:
Is there a simple way to do a bunch of 2d particle images using core animation like the star particle animation in Draw Something?
Particle animation in Draw Something
I found this link which get's me 90% of the way there. It shows how to emit particles using UIImage which is just what I need. I just need some help tweaking the particles so they spew out like the Draw Something button and not like their fire example and I want to randomize the colors of the particles and make them glow.
http://www.raywenderlich.com/6063/uikit-particle-systems-in-ios-5-tutorial
Okay, just found this which got me the rest of the controls I wanted. The variable I was looking for on the emitters was yAccelleration. Set it to a positive number to make it go down.
http://developer.apple.com/library/mac/#samplecode/Fireworks/Listings/AppController_m.html
Hope this helps someone else!
I want to make sort of a chalk board for part of my app, and I was wondering how to accomplish this?
I was thinking I could create a sprite and have it's image set to something very small (maybe a small point), and then add a new instance of that sprite everywhere the user touches to simulate a draw event. Something like [self addChild:someSprite]; for each touch location.
But it seems like that would be extremely memory inefficient. There has to be a better way than that, Maybe drawing actual lines? I'm probably overlooking some method.
Thanks for any help.
You need to use CCRenderTexture for chalk board paintings. Check this article & project for a drawing example.
Your variant isn't such "memory inefficient" as you think. No matter how much sprites will you create with the same texture, your texture will be placed to the memory only once. And all the sprites will use pointer to it. Just one thing to prevent many unnessesary calls is to use CCBatchNode. It will draw all it's children with single draw call. Without using it, draw will be called on every children.
I found the Exploding Ring particle effect best suite what I need but I could not figure out how to control the blast radius of this particle effect. I.e: not exploding out the whole screen but only exploding in a small circle
Does anyone know how to do it?
Thanks in advance
Probably easiest method is to use Particle Designer (http://particledesigner.71squared.com/). It has full Cocos2D support and you can visually see what you want with the editor without having to code it. You can see how to integrate the export files at http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:particles?s[]=particle. Hope that helps!
i'm having trouble with drawing 3D-Models in the right order in XNA.
Here are two images that describe the problem:
Pic1: http://imgur.com/wGPIk&L5AY1l
Pic2: http://imgur.com/wGPIkl&L5AY1
The ball is moving downwards and as soon as it intersects the terrain, the perspective is changing so that it looks like as if the ball is behind the terrain.
If i change the order of drawing, it will look like the ball is on top of the terrain all the time..
Can someone please explain how to solve this problem?
Thanks in advance
The problem is the SpriteBatch call that draws your FPS counter in the corner.
SpriteBatch changes the state of the graphics device. Whenever you're done drawing your 2D objects (in this case, your frame rate counter in the upper-left corner), you need to restore the device state.
After calling SpriteBatch.End(), add this code:
device.DepthStencilState = DepthStencilState.Default;
where device is a reference to the current GraphicsDevice that you're drawing with.
This looks like a ZBuffer problem. Have you checked that your Zbuffer is enabled and working? Try what David Lively said. if that works, check that you don't draw your 3D models Inside the Begin and End calls of the SpriteBatch class.
Begin readies the device for drawing 2D objects, if you try now to call 3D drawing this can't work. End makes sure that everything, set for 2D, is unset and reverted to the states before the Begin call.