You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

新手求助:基于ARCore与Unreal Engine创建N×N米平面及可漫游AR城市

Hey there! Since you're new to both Unreal Engine and ARCore, let's break this down into practical, easy-to-follow steps to build your roamable N×N meter AR city. I’ll focus on hands-on advice that skips overly technical jargon where possible.

1. First: Set Up Your Unreal & ARCore Environment

Before diving into building, make sure your setup is ARCore-ready:

  • Use Unreal Engine 5.0 or newer—these versions have tighter ARCore integration and better out-of-the-box support.
  • Enable the ARCore plugin: Go to Edit > Plugins, search for "ARCore", check the box, and restart Unreal.
  • Configure your project for Android (ARCore’s primary platform):
    • Switch your project's target platform to Android in the toolbar.
    • Go to Edit > Project Settings > Platforms > Android and enable ARCore under the AR section.
    • Add required permissions: In the same Android settings tab, make sure Camera and Fine Location (optional but helpful for larger spaces) are enabled.
2. Create Your N×N Meter AR Plane Anchor

ARCore’s default plane detection finds existing surfaces, but you need a fixed-size plane. Here’s how to make one:

  • Create a new Blueprint (let’s call it BP_ARCityBase) inheriting from ARIActor—this ties it directly to ARCore’s tracking system.
  • Add an ARAnchor component to the blueprint—this is critical for keeping your plane stable as ARCore updates its environment tracking.
  • Add a Static Mesh Component, select the default Plane mesh from the Engine content. To make it N×N meters:
    • If the default Plane is 1x1 meter, set the component’s Scale to (N, 1, N) (e.g., 10 for a 10×10m plane).
  • Add placement logic:
    • Bind a touch/click input event to trigger a line trace. Use AR Line Trace By Channel to detect where the user taps in AR space.
    • If the trace hits a tracked surface, spawn your BP_ARCityBase at that location, and attach it to the ARAnchor to keep it anchored to the real world.
3. Build Your Roamable AR City

Now that you have your base plane, it’s time to populate it:

  • Asset Preparation: Make sure all your 3D assets (buildings, roads, trees) use real-world scale. For example, a small office building should be ~5-10m tall to fit naturally on your N×N plane. If importing assets from other tools, set their import scale to 0.01 (since Unreal uses centimeters by default, this converts to meters).
  • Place Assets:
    • For a simple grid-based city, use a Blueprint loop to spawn buildings evenly across your plane. For example, loop from 0 to N, spawn a building every 2 meters along the X and Z axes.
    • Add collision components to all assets (e.g., Box Collision) so your player can’t walk through them.
  • Roaming Controls:
    • Use Unreal’s ARPawn as your player character—it’s pre-configured for AR movement.
    • Adjust the pawn’s movement settings to feel natural: Set a walk speed of ~3-5 m/s, enable gravity, and make sure its capsule collision interacts with your city assets to prevent walking through walls.
4. Pro Tips for Stability & Realism
  • Keep Your Plane Stable: Always attach your city base and assets to an ARAnchor—never place them directly in world space. ARCore will update the anchor’s position as it refines tracking, preventing your city from drifting.
  • Match Real-World Lighting: Enable ARCore’s Light Estimation in Project Settings > ARCore. Then, in your blueprint, pull the estimated ambient light color and intensity from the AR session and apply it to your scene’s lights. This makes your virtual city blend seamlessly with the real environment.
  • Optimize for Mobile: AR is tough on mobile hardware—use low-poly assets, enable LOD (Level of Detail) for buildings, and compress textures to keep frame rates smooth. Avoid using too many dynamic lights.
  • Debug as You Go: Enable ARCore’s debug visualization in Edit > Project Settings > ARCore—this shows tracked planes, anchors, and feature points, making it easier to spot drift or placement issues.
5. Fix Common Headaches
  • Plane Drift: If your city moves around unexpectedly, make sure you’re in an environment with plenty of texture (e.g., carpet, tiled floors)—ARCore needs visual features to track. Avoid plain, white walls or empty spaces.
  • Walking Through Buildings: Double-check that all assets have collision components enabled, and that the ARPawn’s capsule collision is sized correctly (not too small or too large).
  • Assets Are the Wrong Size: Verify your asset import scale and the plane’s scale—if buildings look tiny or giant, you probably messed up the meter-to-centimeter conversion.

内容的提问来源于stack exchange,提问作者only_dc

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 04:02:15