Hi,
After installing 13.3b4 both WiFi and Ethernet stopped working.
Downgrading to 13.3b2 makes them both working again.
Same happened in 13.3b3.
Does anybody know why?
Thanks
Post
Replies
Boosts
Views
Activity
Hi,
I'm trying to rotate an entity in VisionPro.
Most of the code is the same as the Diorama code from WWDC23.
The problem I'm having is that the rotiation occurs but the axis of the rotation is not the center of my object.
It seems to be centered on the zero coordinate of the immersive space . How do I change the rotation3DEffect to tell it to rotate around the entity? Not the space?
Is it even possible?
This is the code, the rotation is at the end.
var body: some View {
@Bindable var viewModel = viewModel
RealityView { content, _ in
do {
let entity = try await Entity(named: "DioramaAssembled", in: RealityKitContent.RealityKitContentBundle)
viewModel.rootEntity = entity
content.add(entity)
viewModel.updateScale()
// Offset the scene so it doesn't appear underneath the user or conflict with the main window.
entity.position = SIMD3<Float>(0, 0, -2)
subscriptions.append(content.subscribe(to: ComponentEvents.DidAdd.self, componentType: PointOfInterestComponent.self, { event in
createLearnMoreView(for: event.entity)
}))
entity.generateCollisionShapes (recursive: true)
entity.components.set(InputTargetComponent())
} catch {
print("Error in RealityView's make: \(error)")
}
}
.rotation3DEffect(.radians(currentrotateByX), axis: .y)
.rotation3DEffect(.radians(currentrotateByY), axis: .x)
Hi,
I create an entity and add a bunch of attachments (code is based on the Diorama demo).
I can rotate the entity with this:
.gesture(
DragGesture()
.targetedToAnyEntity()
.onChanged { value in
let entity = value.entity
let orientation = Rotation3D(entity.orientation(relativeTo: nil))
let newOrientation: Rotation3D
if (value.location.x >= lastGestureValue) {
newOrientation = orientation.rotated(by: .init(angle: .degrees(0.5), axis: .y))
} else {
newOrientation = orientation.rotated(by: .init(angle: .degrees(-0.5), axis: .y))
}
entity.setOrientation(.init(newOrientation), relativeTo: nil)
lastGestureValue = value.location.x
}
)
But the attachments stay still.
How can I rotate the entity AND the attachment at the same time?
Hi,
I'm trying to have an entity (and some attachments to it) to rotate.
If I add the entity to content, add the attachment as a child entity, and set the entity as InputTargetComponent, then when I add a gesture ONLY the entity rotates and NOT the attachments (added as child entities).
If I add a parent entity with let parentEntity = ModelEntity(), add my entity to the parentEntity, then add the attachments to an entity (which is now a child of the ModelEntity) and set the ModelEntity as InputTargetComponent then the whole thing rotates (including attachments)
I'm sure there must be a bug, why would it work only with an added ModelEntity?
Anyway, bug or not a bug, the problem I have now is that it rotates around the axes of the ModelEntity, not my primary entity, which is what I want.
Is there a way to set the ModelEntity axes to be the axes of my primary child entity so it rotates like I want?
What call should I use to move the axes where would I find the axes of the first child entity which should be the focus of my app?
Here is my code:
var body: some View {
RealityView { content, attachments in
// Add the initial RealityKit content
if let specimenentity = try? await Entity(named: "Immersive", in: realityKitContentBundle) {
let parentEntity = ModelEntity()
parentEntity.addChild(specimenentity)
content.add(parentEntity)
let entityBounds = specimenentity.visualBounds(relativeTo: parentEntity)
parentEntity.collision = CollisionComponent(shapes: [ShapeResource.generateBox(size: entityBounds.extents).offsetBy(translation: entityBounds.center)])
parentEntity.generateCollisionShapes (recursive: true)
parentEntity.components.set(InputTargetComponent())
if let Left_Hemisphere = attachments.entity(for: "Left_Hemisphere") {
//4. Position the Attachment and add it to the RealityViewContent
Left_Hemisphere.position = [-0.5, 1, 0]
specimenentity.addChild(Left_Hemisphere)
}
}
} attachments: {
Attachment(id: "Left_Hemisphere") {
//2. Define the SwiftUI View
Text("Left_Hemisphere")
.font(.extraLargeTitle)
.padding()
.glassBackgroundEffect()
}
}
.gesture(
DragGesture()
.targetedToAnyEntity()
.onChanged { value in
let entity = value.entity
var orientation = Rotation3D(entity.orientation(relativeTo: nil))
var newOrientation: Rotation3D
if (value.location.x >= lastGestureValueX) {
newOrientation = orientation.rotated(by: .init(angle: .degrees(0.5), axis: .y))
} else {
newOrientation = orientation.rotated(by: .init(angle: .degrees(-0.5), axis: .y))
}
entity.setOrientation(.init(newOrientation), relativeTo: nil)
lastGestureValueX = value.location.x
orientation = Rotation3D(entity.orientation(relativeTo: nil))
if (value.location.y >= lastGestureValueY) {
newOrientation = orientation.rotated(by: .init(angle: .degrees(0.5), axis: .x))
} else {
newOrientation = orientation.rotated(by: .init(angle: .degrees(-0.5), axis: .x))
}
entity.setOrientation(.init(newOrientation), relativeTo: nil)
lastGestureValueY = value.location.y
}
)
}
}